A heap-allocated, fixed-size array whose capacity cannot change after construction.
More...
|
| | FixedSizeVector ()=default |
| | Constructs an empty vector with zero elements.
|
| | FixedSizeVector (size_t const len) |
| | Constructs a vector with len default-initialized elements.
|
| | FixedSizeVector (std::initializer_list< T > init) |
| | Constructs a fixed size vector with given values.
|
| | FixedSizeVector (const FixedSizeVector &other) |
| | Creates a deep copy of another vector's elements.
|
| FixedSizeVector & | operator= (const FixedSizeVector &other) |
| | Assigns a copy of another vector to this vector.
|
| | FixedSizeVector (FixedSizeVector &&other) noexcept |
| | Transfers ownership of the managed array from another vector.
|
| FixedSizeVector & | operator= (FixedSizeVector &&other) noexcept |
| | Move-assigns from another FixedSizeVector.
|
| | ~FixedSizeVector ()=default |
| | Destructor. Releases the managed array.
|
| void | swap (FixedSizeVector &other) noexcept |
| | Swaps the contents of this vector with other.
|
| void | delete_and_resize (size_t const len) |
| | Replaces the storage with a new allocation of len elements.
|
| T & | operator[] (size_t const i) |
| | Unchecked element access (non-const).
|
| const T & | operator[] (size_t const i) const |
| | Accesses an element at a specific index without bounds checking.
|
| T & | at (size_t const i) |
| | Accesses an element at a given index with bounds checking.
|
| const T & | at (size_t const i) const |
| | Bounds-checked element access (const).
|
| T * | begin () |
| | Accesses the first element of the underlying array.
|
| T * | end () |
| | Provides a pointer to the position past the last element.
|
| const T * | begin () const |
| | Obtains a const pointer to the first element.
|
| const T * | end () const |
| | Obtains a const pointer to one past the last element.
|
| const T * | cbegin () const |
| | Obtains a const pointer to the first element.
|
| const T * | cend () const |
| | Provides a const pointer to one past the last element.
|
| size_t | size () const |
| | Queries the number of elements.
|
template<typename T>
class cda_rail::FixedSizeVector< T >
A heap-allocated, fixed-size array whose capacity cannot change after construction.
Provides a lightweight alternative to std::vector<T> for situations where the number of elements is determined at run time but remains constant for the lifetime of the object. The storage is managed through a std::unique_ptr<T[]>, giving deterministic ownership without the capacity overhead of std::vector.
- Template Parameters
-
| T | Element type. Must be default-constructible because the underlying array is zero-initialized on construction. |
- Invariant
- All indices in [0, size()) refer to valid, initialized elements.