|
BCNP 3.2.1
Batched Command Network Protocol
|
Fixed-capacity vector with no heap allocation. More...
#include <static_vector.h>
Public Types | |
| using | value_type = T |
| Element type. | |
| using | size_type = std::size_t |
| Size/index type. | |
| using | iterator = T* |
| Mutable iterator type. | |
| using | const_iterator = const T* |
| Const iterator type. | |
Public Member Functions | |
| StaticVector () noexcept=default | |
| Default constructor - creates empty vector. | |
| StaticVector (std::initializer_list< T > init) | |
| Construct from initializer list. | |
| StaticVector (const StaticVector &other) | |
| Copy constructor - deep copies all elements. | |
| StaticVector (StaticVector &&other) noexcept(std::is_nothrow_move_constructible_v< T >) | |
| Move constructor - moves all elements. | |
| StaticVector & | operator= (const StaticVector &other) |
| Copy assignment operator. | |
| StaticVector & | operator= (StaticVector &&other) noexcept(std::is_nothrow_move_constructible_v< T > &&std::is_nothrow_destructible_v< T >) |
| Move assignment operator. | |
| ~StaticVector () | |
| Destructor - properly destroys all elements. | |
| size_type | size () const noexcept |
| Get current number of elements. | |
| constexpr size_type | capacity () const noexcept |
| Get maximum capacity (compile-time constant). | |
| bool | empty () const noexcept |
| Check if vector is empty. | |
| T & | operator[] (size_type index) noexcept |
| Access element by index (no bounds checking). | |
| const T & | operator[] (size_type index) const noexcept |
| Access element by index (no bounds checking). | |
| T & | at (size_type index) |
| Access element with bounds checking. | |
| const T & | at (size_type index) const |
| Access element with bounds checking. | |
| T & | front () noexcept |
| Access first element (undefined if empty). | |
| const T & | front () const noexcept |
| Access first element (undefined if empty). | |
| T & | back () noexcept |
| Access last element (undefined if empty). | |
| const T & | back () const noexcept |
| Access last element (undefined if empty). | |
| T * | data () noexcept |
| Get pointer to underlying storage. | |
| const T * | data () const noexcept |
| Get pointer to underlying storage. | |
| void | clear () noexcept |
| Remove all elements. | |
| void | push_back (const T &value) |
| Add element by copy. | |
| void | push_back (T &&value) |
| Add element by move. | |
| template<typename... Args> | |
| T & | emplace_back (Args &&... args) |
| Construct element in-place at end. | |
| void | pop_back () noexcept |
| Remove last element. | |
| void | resize (size_type new_size) |
| Resize the vector. | |
| void | resize (size_type new_size, const T &value) |
| Resize with fill value. | |
| void | reserve (size_type requested) |
| Reserve capacity (no-op for StaticVector). | |
Iterators | |
| 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 |
Fixed-capacity vector with no heap allocation.
Stores elements in-place using aligned storage.
| T | Element type |
| Capacity | Maximum number of elements |
Definition at line 29 of file static_vector.h.
| using bcnp::StaticVector< T, Capacity >::const_iterator = const T* |
Const iterator type.
Definition at line 34 of file static_vector.h.
| using bcnp::StaticVector< T, Capacity >::iterator = T* |
Mutable iterator type.
Definition at line 33 of file static_vector.h.
| using bcnp::StaticVector< T, Capacity >::size_type = std::size_t |
Size/index type.
Definition at line 32 of file static_vector.h.
| using bcnp::StaticVector< T, Capacity >::value_type = T |
Element type.
Definition at line 31 of file static_vector.h.
|
defaultnoexcept |
Default constructor - creates empty vector.
|
inline |
Construct from initializer list.
| init | Elements to copy into the vector |
| std::out_of_range | if init.size() > Capacity |
Definition at line 44 of file static_vector.h.
|
inline |
Copy constructor - deep copies all elements.
| other | Vector to copy from |
Definition at line 57 of file static_vector.h.
|
inlinenoexcept |
Move constructor - moves all elements.
| other | Vector to move from (left empty after move) |
Definition at line 67 of file static_vector.h.
|
inline |
Destructor - properly destroys all elements.
Definition at line 108 of file static_vector.h.
|
inline |
Access element with bounds checking.
| index | Element index |
| std::out_of_range | if index >= size() |
Definition at line 145 of file static_vector.h.
|
inline |
Access element with bounds checking.
| index | Element index |
| std::out_of_range | if index >= size() |
Definition at line 153 of file static_vector.h.
|
inlinenoexcept |
Access last element (undefined if empty).
Definition at line 168 of file static_vector.h.
|
inlinenoexcept |
Access last element (undefined if empty).
Definition at line 166 of file static_vector.h.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
Get maximum capacity (compile-time constant).
Definition at line 114 of file static_vector.h.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Remove all elements.
Destroys elements in reverse order for proper cleanup of interdependent objects.
Definition at line 181 of file static_vector.h.
|
inlinenoexcept |
Get pointer to underlying storage.
Definition at line 173 of file static_vector.h.
|
inlinenoexcept |
Get pointer to underlying storage.
Definition at line 171 of file static_vector.h.
|
inline |
Construct element in-place at end.
| Args | Constructor argument types |
| args | Arguments forwarded to T's constructor |
| std::out_of_range | if size() >= Capacity |
Definition at line 223 of file static_vector.h.
|
inlinenoexcept |
Check if vector is empty.
Definition at line 117 of file static_vector.h.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Access first element (undefined if empty).
Definition at line 163 of file static_vector.h.
|
inlinenoexcept |
Access first element (undefined if empty).
Definition at line 161 of file static_vector.h.
|
inline |
Copy assignment operator.
| other | Vector to copy from |
Definition at line 80 of file static_vector.h.
|
inlinenoexcept |
Move assignment operator.
| other | Vector to move from (left empty after move) |
Definition at line 95 of file static_vector.h.
|
inlinenoexcept |
Access element by index (no bounds checking).
| index | Element index |
Definition at line 137 of file static_vector.h.
|
inlinenoexcept |
Access element by index (no bounds checking).
| index | Element index |
Definition at line 134 of file static_vector.h.
|
inlinenoexcept |
Remove last element.
Does nothing if vector is empty.
Definition at line 237 of file static_vector.h.
|
inline |
Add element by copy.
| value | Element to copy |
| std::out_of_range | if size() >= Capacity |
Definition at line 194 of file static_vector.h.
|
inline |
Add element by move.
| value | Element to move from |
| std::out_of_range | if size() >= Capacity |
Definition at line 207 of file static_vector.h.
|
inline |
Reserve capacity (no-op for StaticVector).
Provided for API compatibility with std::vector in generic code. Throws if requested capacity exceeds compile-time Capacity.
| requested | Requested capacity |
| std::out_of_range | if requested > Capacity |
Definition at line 291 of file static_vector.h.
|
inline |
Resize the vector.
Shrinking destroys excess elements. Growing default-constructs new ones.
| new_size | Target size |
| std::out_of_range | if new_size > Capacity |
Definition at line 252 of file static_vector.h.
|
inline |
Resize with fill value.
| new_size | Target size |
| value | Value to copy when growing |
| std::out_of_range | if new_size > Capacity |
Definition at line 270 of file static_vector.h.
|
inlinenoexcept |
Get current number of elements.
Definition at line 111 of file static_vector.h.