|
Nebula
|
#include <fixedarray.h>
Implements a fixed size one-dimensional array.
Public Types | |
| typedef TYPE * | Iterator |
| define element iterator | |
Public Member Functions | |
| FixedArray () | |
| default constructor | |
| FixedArray (const SizeT s) | |
| constructor with size | |
| FixedArray (const SizeT s, const TYPE &initialValue) | |
| constructor with size and initial value | |
| FixedArray (const FixedArray< TYPE, false > &rhs) | |
| copy constructor | |
| FixedArray (const FixedArray< TYPE, true > &rhs) | |
| copy constructor | |
| FixedArray (const Array< TYPE > &rhs) | |
| construct from array | |
| FixedArray (Array< TYPE > &&rhs) | |
| move from array | |
| FixedArray (FixedArray< TYPE, StackAlloc > &&rhs) | |
| move constructor | |
| FixedArray (std::initializer_list< TYPE > list) | |
| constructor from initializer list | |
| FixedArray (std::nullptr_t) | |
| construct an empty fixed array | |
| ~FixedArray () | |
| destructor | |
| void | operator= (const FixedArray< TYPE, StackAlloc > &rhs) |
| assignment operator | |
| void | operator= (FixedArray< TYPE, StackAlloc > &&rhs) noexcept |
| move assignment operator | |
| TYPE & | operator[] (IndexT index) const |
| write [] operator | |
| bool | operator== (const FixedArray< TYPE, StackAlloc > &rhs) const |
| equality operator | |
| bool | operator!= (const FixedArray< TYPE, StackAlloc > &rhs) const |
| inequality operator | |
| void | SetSize (SizeT s) |
| set number of elements (clears existing content) | |
| const SizeT | Size () const |
| get number of elements | |
| const SizeT | ByteSize () const |
| get total byte size | |
| void | Resize (SizeT newSize) |
| resize array without deleting existing content | |
| bool | IsEmpty () const |
| return true if array if empty (has no elements) | |
| void | Clear () |
| clear the array, free elements | |
| void | Fill (const TYPE &val) |
| fill the entire array with a value | |
| void | Fill (IndexT first, SizeT num, const TYPE &val) |
| fill array range with element | |
| Iterator | Begin () const |
| get iterator to first element | |
| Iterator | End () const |
| get iterator past last element | |
| Iterator | Find (const TYPE &val) const |
| find identical element in unsorted array (slow) | |
| IndexT | FindIndex (const TYPE &val) const |
| find index of identical element in unsorted array (slow) | |
| void | Sort () |
| sort the array | |
| IndexT | BinarySearchIndex (const TYPE &val) const |
| do a binary search, requires a sorted array | |
| Array< TYPE > | AsArray () const |
| return content as Array (slow!) | |
| Iterator | begin () const |
| for range-based iteration (C++11) | |
| Iterator | end () const |
| size_t | size () const |
| void | resize (size_t size) |
Private Member Functions | |
| void | Delete () |
| delete content | |
| void | Alloc (SizeT s) |
| allocate array for given size | |
| void | Copy (const FixedArray< TYPE, StackAlloc > &src) |
| copy content | |
Private Attributes | |
| SizeT | count |
| TYPE * | elements |
Friends | |
| template<class T, bool S> | |
| class | FixedArray |
| typedef TYPE* Util::FixedArray< TYPE, StackAlloc >::Iterator |
define element iterator
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | ) |
default constructor
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | const SizeT | s | ) |
constructor with size
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | const SizeT | s, |
| const TYPE & | initialValue ) |
constructor with size and initial value
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | const FixedArray< TYPE, false > & | rhs | ) |
copy constructor
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | const FixedArray< TYPE, true > & | rhs | ) |
copy constructor
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | const Array< TYPE > & | rhs | ) |
construct from array
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | Array< TYPE > && | rhs | ) |
move from array
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | FixedArray< TYPE, StackAlloc > && | rhs | ) |
move constructor
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | std::initializer_list< TYPE > | list | ) |
constructor from initializer list
| Util::FixedArray< TYPE, StackAlloc >::FixedArray | ( | std::nullptr_t | ) |
construct an empty fixed array
| Util::FixedArray< TYPE, StackAlloc >::~FixedArray | ( | ) |
destructor
|
private |
allocate array for given size
| Array< TYPE > Util::FixedArray< TYPE, StackAlloc >::AsArray | ( | ) | const |
return content as Array (slow!)
| FixedArray< TYPE, StackAlloc >::Iterator Util::FixedArray< TYPE, StackAlloc >::Begin | ( | ) | const |
get iterator to first element
| FixedArray< TYPE, StackAlloc >::Iterator Util::FixedArray< TYPE, StackAlloc >::begin | ( | ) | const |
for range-based iteration (C++11)
| IndexT Util::FixedArray< TYPE, StackAlloc >::BinarySearchIndex | ( | const TYPE & | elm | ) | const |
| const SizeT Util::FixedArray< TYPE, StackAlloc >::ByteSize | ( | ) | const |
get total byte size
| void Util::FixedArray< TYPE, StackAlloc >::Clear | ( | ) |
clear the array, free elements
|
private |
copy content
NOTE: only works on deleted array.
This is intended.
|
private |
delete content
| FixedArray< TYPE, StackAlloc >::Iterator Util::FixedArray< TYPE, StackAlloc >::End | ( | ) | const |
get iterator past last element
| FixedArray< TYPE, StackAlloc >::Iterator Util::FixedArray< TYPE, StackAlloc >::end | ( | ) | const |
| void Util::FixedArray< TYPE, StackAlloc >::Fill | ( | const TYPE & | val | ) |
fill the entire array with a value
| void Util::FixedArray< TYPE, StackAlloc >::Fill | ( | IndexT | first, |
| SizeT | num, | ||
| const TYPE & | val ) |
fill array range with element
| FixedArray< TYPE, StackAlloc >::Iterator Util::FixedArray< TYPE, StackAlloc >::Find | ( | const TYPE & | val | ) | const |
find identical element in unsorted array (slow)
| IndexT Util::FixedArray< TYPE, StackAlloc >::FindIndex | ( | const TYPE & | val | ) | const |
find index of identical element in unsorted array (slow)
| bool Util::FixedArray< TYPE, StackAlloc >::IsEmpty | ( | ) | const |
return true if array if empty (has no elements)
| bool Util::FixedArray< TYPE, StackAlloc >::operator!= | ( | const FixedArray< TYPE, StackAlloc > & | rhs | ) | const |
inequality operator
| void Util::FixedArray< TYPE, StackAlloc >::operator= | ( | const FixedArray< TYPE, StackAlloc > & | rhs | ) |
assignment operator
|
noexcept |
move assignment operator
| bool Util::FixedArray< TYPE, StackAlloc >::operator== | ( | const FixedArray< TYPE, StackAlloc > & | rhs | ) | const |
equality operator
| TYPE & Util::FixedArray< TYPE, StackAlloc >::operator[] | ( | IndexT | index | ) | const |
write [] operator
| void Util::FixedArray< TYPE, StackAlloc >::Resize | ( | SizeT | newSize | ) |
resize array without deleting existing content
| void Util::FixedArray< TYPE, StackAlloc >::resize | ( | size_t | size | ) |
| void Util::FixedArray< TYPE, StackAlloc >::SetSize | ( | SizeT | s | ) |
set number of elements (clears existing content)
| const SizeT Util::FixedArray< TYPE, StackAlloc >::Size | ( | ) | const |
get number of elements
| size_t Util::FixedArray< TYPE, StackAlloc >::size | ( | ) | const |
| void Util::FixedArray< TYPE, StackAlloc >::Sort | ( | ) |
sort the array
|
friend |
|
private |
|
private |