template<class TYPE>
class Util::TrivialArray< TYPE >
Array class based on Util::Array for trivial and POD types that avoids any per element copying and constructor/destructor calls.
- Copyright
- (C) 2018-2020 Individual contributors, see AUTHORS file
|
| TrivialArray () |
| constructor with default parameters
|
|
| TrivialArray (SizeT initialCapacity, SizeT initialGrow) |
| constuctor with initial size and grow size
|
|
| TrivialArray (SizeT initialSize, SizeT initialGrow, const TYPE &initialValue) |
| constructor with initial size, grow size and initial values
|
|
| TrivialArray (const TrivialArray< TYPE > &rhs) |
| copy constructor
|
|
| TrivialArray (const Array< TYPE > &rhs) |
| copy constructor from Array
|
|
| TrivialArray (std::initializer_list< TYPE > list) |
| constructor from initializer list
|
|
| ~TrivialArray () |
| destructor
|
|
void | operator= (const TrivialArray< TYPE > &rhs) |
| assignment operator
|
|
void | operator= (const Array< TYPE > &rhs) |
| assignment operator from array
|
|
void | EraseIndex (IndexT index) |
| erase element at index, keep sorting intact
|
|
void | EraseIndexSwap (IndexT index) |
| erase element at index, fill gap by swapping in last element, destroys sorting!
|
|
void | Clear () |
| clear array (calls destructors)
|
|
| Array () |
| constructor with default parameters
|
|
| Array (SizeT initialCapacity, SizeT initialGrow) |
| constuctor with initial size and grow size
|
|
| Array (SizeT initialSize, SizeT initialGrow, const TYPE &initialValue) |
| constructor with initial size, grow size and initial values
|
|
| Array (const ArrayT &rhs) |
| copy constructor
|
|
| Array (ArrayT &&rhs) noexcept |
| move constructor
|
|
| Array (std::initializer_list< TYPE > list) |
| constructor from initializer list
|
|
| Array (std::nullptr_t) |
| construct an empty fixed array
|
|
| Array (const TYPE *const buf, SizeT num) |
| constructor from TYPE pointer and size.
|
|
| ~Array () |
| destructor
|
|
void | operator= (const Array< TYPE, SMALL_VECTOR_SIZE > &rhs) |
| assignment operator
|
|
void | operator= (Array< TYPE, SMALL_VECTOR_SIZE > &&rhs) noexcept |
| move operator
|
|
TYPE & | operator[] (IndexT index) const |
| [] operator
|
|
TYPE & | operator[] (IndexT index) |
| [] operator
|
|
bool | operator== (const Array< TYPE, SMALL_VECTOR_SIZE > &rhs) const |
| equality operator
|
|
bool | operator!= (const Array< TYPE, SMALL_VECTOR_SIZE > &rhs) const |
| inequality operator
|
|
template<typename T > |
T | As () const |
| convert to "anything"
|
|
TYPE & | Get (IndexT index) const |
| Get element (same as operator[] but as a function)
|
|
template<typename ... ELEM_TYPE> |
void | Append (const TYPE &first, const ELEM_TYPE &... elements) |
| Append multiple elements to the end of the array.
|
|
void | Append (const TYPE &elm) |
| append element to end of array
|
|
void | Append (TYPE &&elm) |
| append an element which is being forwarded
|
|
void | AppendArray (const Array< TYPE, SMALL_VECTOR_SIZE > &rhs) |
| append the contents of an array to this array
|
|
void | AppendArray (const TYPE *arr, const SizeT count) |
| append from C array
|
|
TYPE & | Emplace () |
| Emplace item (create new item and return reference)
|
|
TYPE * | EmplaceArray (const SizeT count) |
| Emplace range of items and return pointer to first.
|
|
void | Reserve (SizeT num) |
| increase capacity to fit N more elements into the array.
|
|
const SizeT | Size () const |
| get number of elements in array
|
|
const SizeT | ByteSize () const |
| return the byte size of the array.
|
|
const SizeT | Capacity () const |
| get overall allocated size of array in number of elements
|
|
TYPE & | Front () const |
| return reference to first element
|
|
TYPE & | Back () const |
| return reference to last element
|
|
bool | IsEmpty () const |
| return true if array empty
|
|
bool | IsValidIndex (IndexT index) const |
| check if index is valid
|
|
void | EraseIndex (IndexT index) |
| erase element at index, keep sorting intact
|
|
Iterator | Erase (Iterator iter) |
| erase element pointed to by iterator, keep sorting intact
|
|
void | EraseIndexSwap (IndexT index) |
| erase element at index, fill gap by swapping in last element, destroys sorting!
|
|
Iterator | EraseSwap (Iterator iter) |
| erase element at iterator, fill gap by swapping in last element, destroys sorting!
|
|
void | EraseRange (IndexT start, IndexT end) |
| erase range, excluding the element at end
|
|
void | EraseBack () |
| erase back
|
|
void | EraseFront () |
| erase front
|
|
TYPE | PopFront () |
| Pop front.
|
|
TYPE | PopBack () |
| Pop back.
|
|
void | Insert (IndexT index, const TYPE &elm) |
| insert element before element at index
|
|
IndexT | InsertSorted (const TYPE &elm) |
| insert element into sorted array, return index where element was included
|
|
IndexT | InsertAtEndOfIdenticalRange (IndexT startIndex, const TYPE &elm) |
| insert element at the first non-identical position, return index of inclusion position
|
|
bool | IsSorted () const |
| test if the array is sorted, this is a slow operation!
|
|
void | Clear () |
| clear array (calls destructors)
|
|
void | Reset () |
| reset array (does NOT call destructors)
|
|
void | Free () |
| free memory and reset size
|
|
Iterator | Begin () const |
| return iterator to beginning of array
|
|
ConstIterator | ConstBegin () const |
| return const iterator to beginning of array
|
|
Iterator | End () const |
| return iterator to end of array
|
|
ConstIterator | ConstEnd () const |
| return const iterator to end of array
|
|
Iterator | Find (const TYPE &elm, const IndexT start=0) const |
| find identical element in array, return iterator
|
|
IndexT | FindIndex (const TYPE &elm, const IndexT start=0) const |
| find identical element in array, return index, InvalidIndex if not found
|
|
template<typename KEYTYPE > |
IndexT | FindIndex (typename std::enable_if< true, const KEYTYPE & >::type elm, const IndexT start=0) const |
| find identical element using a specific key type
|
|
void | Fill (IndexT first, SizeT num, const TYPE &elm) |
| fill array range with element
|
|
void | Realloc (SizeT capacity, SizeT grow) |
| clear contents and preallocate with new attributes
|
|
ArrayT | Difference (const Array< TYPE, SMALL_VECTOR_SIZE > &rhs) |
| returns new array with elements which are not in rhs (slow!)
|
|
void | Sort () |
| sort the array
|
|
void | QuickSort () |
| quick sort the array
|
|
void | SortWithFunc (bool(*func)(const TYPE &lhs, const TYPE &rhs)) |
| sort with custom function
|
|
void | QuickSortWithFunc (int(*func)(const void *lhs, const void *rhs)) |
| quick sort the array
|
|
IndexT | BinarySearchIndex (const TYPE &elm) const |
| do a binary search, requires a sorted array
|
|
template<typename KEYTYPE > |
IndexT | BinarySearchIndex (typename std::enable_if< true, const KEYTYPE & >::type elm) const |
| do a binary search using a specific key type
|
|
void | Resize (SizeT num) |
| Set size. Grows array if num is greater than capacity. Calls destroy on all objects at index > num!
|
|
template<typename ... ARGS> |
void | Resize (SizeT num, ARGS... args) |
| Resize and fill new elements with arguments.
|
|
void | Extend (SizeT num) |
| Resize to fit the provided value, but don't shrink if the new size is smaller.
|
|
void | Fit () |
| Fit the size of the array to the amount of elements.
|
|
constexpr SizeT | TypeSize () const |
| Returns sizeof(TYPE)
|
|
Iterator | begin () const |
| for range-based iteration
|
|
Iterator | end () const |
|
size_t | size () const |
|
void | resize (size_t size) |
|
void | clear () noexcept |
|
void | push_back (const TYPE &item) |
|
void | Grow () |
| grow array with grow value
|
|