|
| | Array () |
| | Initialize empty array without allocator.
|
| |
| | Array (IAllocator &allocator) |
| | Initialize empty array.
|
| |
| size_t | capacity () const |
| | Get maximum number of elements. If array has allocator, capacity can be grown.
|
| |
| size_t | size () const |
| | Get number of elements.
|
| |
| T * | data () |
| | Get pointer to first element.
|
| |
| const T * | data () const |
| | Get pointer to first element.
|
| |
| T & | operator[] (size_t index) |
| | Get element at given position.
|
| |
| const T & | operator[] (size_t index) const |
| | Get element at given position.
|
| |
| void | push_back (const T &value) |
| | Append element to array.
|
| |
| bool | resize (size_t sz) |
| | Set array size.
|
| |
| bool | grow (size_t max_sz) |
| | Increase array capacity.
|
| |
| bool | grow_exp (size_t min_size) |
| | Increase array capacity exponentially.
|
| |
template<class T, size_t EmbeddedCapacity = 0>
class roc::core::Array< T, EmbeddedCapacity >
Dynamic array.
Elements are stored continuously in a memory chunk allocated using IAllocator. Small chunks can be stored directly in Array object, without extra allocation. Array can be resized only by explicitly calling resize(), grow(), or grow_exp(). Elements are copied during resize and old copies are destroyed.
- Template Parameters
-
| T | defines array element type. It should have copy constructor and destructor. |
| EmbeddedCapacity | defines the size of the fixed-size array embedded directly into Array object; it is used instead of dynamic memory if the array size is small enough. |
Definition at line 38 of file array.h.