|
| | NCollection_LinearVector () noexcept=default |
| | Empty constructor.
|
| |
| | NCollection_LinearVector (const size_t theCapacity) |
| | Constructor with pre-allocated capacity. Unlike std::vector(n), this constructor does not create elements. Use Resize() or NCollection_LinearVector(theSize, theValue) to construct items.
|
| |
| | NCollection_LinearVector (const size_t theSize, const TheItemType &theValue) |
| | Constructor creating theSize elements initialized to theValue. Equivalent to std::vector(n, val).
|
| |
| | NCollection_LinearVector (const NCollection_LinearVector &theOther) |
| | Copy constructor.
|
| |
| | NCollection_LinearVector (NCollection_LinearVector &&theOther) noexcept |
| | Move constructor.
|
| |
| | ~NCollection_LinearVector () |
| | Destructor.
|
| |
| NCollection_LinearVector & | operator= (const NCollection_LinearVector &theOther) |
| | Copy assignment.
|
| |
| NCollection_LinearVector & | operator= (NCollection_LinearVector &&theOther) noexcept |
| | Move assignment.
|
| |
| TheItemType * | Data () noexcept |
| |
| const TheItemType * | Data () const noexcept |
| |
| bool | HasData () const noexcept |
| |
| bool | Empty () const noexcept |
| |
| size_t | Size () const noexcept |
| |
| bool | IsEmpty () const noexcept |
| |
| size_t | Capacity () const noexcept |
| |
| void | Reserve (const size_t theCapacity) |
| | Pre-allocate memory for at least theCapacity elements without changing size.
|
| |
| void | Resize (const size_t theSize) |
| | Change the number of elements. If theSize > Size(), new elements are default-constructed. If theSize < Size(), excess elements are destroyed.
|
| |
| void | Resize (const size_t theSize, const TheItemType &theValue) |
| | Change the number of elements, filling new slots with theValue. If theSize > Size(), new elements are copy-constructed from theValue. If theSize < Size(), excess elements are destroyed.
|
| |
| const TheItemType & | Value (const size_t theIndex) const |
| |
| TheItemType & | ChangeValue (const size_t theIndex) |
| |
| const TheItemType & | operator() (const size_t theIndex) const |
| |
| TheItemType & | operator() (const size_t theIndex) |
| |
| const TheItemType & | operator[] (const size_t theIndex) const |
| |
| TheItemType & | operator[] (const size_t theIndex) |
| |
| const TheItemType & | First () const |
| |
| TheItemType & | ChangeFirst () |
| |
| const TheItemType & | Last () const |
| |
| TheItemType & | ChangeLast () |
| |
| TheItemType & | Append (const TheItemType &theValue) |
| | Append a copy of theValue to the end.
|
| |
| TheItemType & | Append (TheItemType &&theValue) |
| | Append theValue by move to the end.
|
| |
| TheItemType & | Appended () |
| | Append a default-constructed element.
|
| |
| template<class... Args> |
| TheItemType & | EmplaceAppend (Args &&... theArgs) |
| | Append an element constructed in-place with the given arguments.
|
| |
| TheItemType & | SetValue (const size_t theIndex, const TheItemType &theValue) |
| | Set value at theIndex. If theIndex >= Size(), the vector is extended.
|
| |
| TheItemType & | SetValue (const size_t theIndex, TheItemType &&theValue) |
| | Set value at theIndex by move. If theIndex >= Size(), the vector is extended.
|
| |
| void | InsertBefore (const size_t theIndex, const TheItemType &theValue) |
| | Insert theValue before theIndex, shifting elements right.
|
| |
| void | InsertAfter (const size_t theIndex, const TheItemType &theValue) |
| | Insert theValue after theIndex, shifting elements right.
|
| |
| void | InsertBefore (const size_t theIndex, TheItemType &&theValue) |
| | Insert theValue before theIndex, shifting elements right.
|
| |
| void | InsertAfter (const size_t theIndex, TheItemType &&theValue) |
| | Insert theValue after theIndex, shifting elements right.
|
| |
| void | EraseLast () |
| | Remove the last element.
|
| |
| void | Erase (const size_t theIndex) |
| | Remove element at theIndex, shifting subsequent elements left.
|
| |
| void | Erase (const size_t theFrom, const size_t theTo) |
| | Remove elements in range [theFrom, theTo), shifting subsequent elements left.
|
| |
| void | Clear (const bool theReleaseMemory=false) |
| | Remove all elements.
|
| |
| iterator | begin () noexcept |
| |
| iterator | end () noexcept |
| |
| const_iterator | begin () const noexcept |
| |
| const_iterator | end () const noexcept |
| |
| const_iterator | cbegin () const noexcept |
| |
| const_iterator | cend () const noexcept |
| |
Contiguous dynamic array using a flat memory buffer.
Unlike NCollection_DynamicArray which uses segmented block storage, this container stores all elements in a single contiguous allocation, providing O(1) element access with a single pointer dereference.
For trivially copyable types, growth uses Standard::Reallocate which can extend the buffer in-place without copying elements. For non-trivial types, growth allocates a new buffer and move-constructs elements.
Indices are always 0-based.
- Warning
- Any operation that may grow the buffer - Append, Appended, EmplaceAppend, SetValue past end, Resize, Reserve, InsertBefore, InsertAfter, copy/move assignment - invalidates all iterators, references, and raw pointers into the vector whenever it actually reallocates. Erase/EraseLast also invalidate references at or beyond the removed position.