Generic template vector. More...
Public Member Functions | |
| ndArray () | |
| constructor, set count and capacity to zero, not memory is allocated. | |
| ndArray (ndInt32 count) | |
| constructor, set count and capacity, allocated space for count elements. | |
| ndArray (const ndArray &source) | |
| copy constructor, allocate and copy only m_size elements from source. | |
| ~ndArray () | |
| deallocate all memory, dos not call destructor on any of th elements. | |
| ndInt32 | GetCount () const |
| return the size of the array. | |
| void | SetCount (ndInt32 count) |
| Set a new size. More... | |
| void | Resize (ndInt32 count) |
| Set a new size. More... | |
| ndInt32 | GetCapacity () const |
| return the capacity of the array. | |
| T & | operator[] (ndInt32 i) |
| Get the i element for the array. More... | |
| const T & | operator[] (ndInt32 i) const |
| Get the i element for the array. More... | |
| void | Swap (ndArray &other) |
| Interchange all the information with other. More... | |
| void | PushBack (const T &element) |
| Add element to the end of the buffer. More... | |
| void | RandomShuffle (ndInt32 count) |
| Randomize the vector entries. | |
| void | ResetMembers () |
| set all member to 0. More... | |
| void | SetMembers (ndInt32 size, void *const memory) |
| assign all members. More... | |
Public Member Functions inherited from ndClassAlloc | |
| ndClassAlloc () | |
| Empty default constructor. | |
| ~ndClassAlloc () | |
| Empty. | |
Protected Attributes | |
| T * | m_array |
| ndInt32 | m_size |
| ndInt32 | m_capacity |
Additional Inherited Members | |
Static Public Member Functions inherited from ndClassAlloc | |
| D_OPERATOR_NEW_AND_DELETE static D_CORE_API void * | Malloc (size_t size) |
| Generic allocation for any function subclass from ndClassAlloc. | |
| static D_CORE_API void | Free (void *const ptr) |
| Generic destruction for any function subclass from ndClassAlloc. | |
Generic template vector.
note: this template vector is similar to std::vector but has some significant differences. therefore is not meant to be a replacement of the sdt::vector, it is simple a tool for this engine
| T & ndArray< T >::operator[] | ( | ndInt32 | i | ) |
Get the i element for the array.
behavior is undefined is i is larger of equal to the array size
| const T & ndArray< T >::operator[] | ( | ndInt32 | i | ) | const |
Get the i element for the array.
behavior is undefined is i is larger of equal to the array size
| void ndArray< T >::PushBack | ( | const T & | element | ) |
Add element to the end of the buffer.
size is incremented by one, and the array is resized if it reaches max capacity
| void ndArray< T >::ResetMembers |
set all member to 0.
useful for when making vectors of vectors (ex matrices)
| void ndArray< T >::Resize | ( | ndInt32 | count | ) |
Set a new size.
the array resized to count, all the data is simply copied to the new array and old array is deleted.
| void ndArray< T >::SetCount | ( | ndInt32 | count | ) |
Set a new size.
if count is larger than m_size, the array resized by doubling its size, all the data is simply copied to the new array and old array is deleted.
| void ndArray< T >::SetMembers | ( | ndInt32 | size, |
| void *const | memory | ||
| ) |
assign all members.
useful for when making vectors of vectors (ex matrices)