|
nfx-containers 0.6.0
Modern C++20 header-only library providing high-performance hash containers with Robin Hood and perfect hashing
|
Vector with stack storage optimization. More...
#include <nfx/containers/StackVector.h>
Public Types | |
| using | value_type = T |
| Type alias for element type. | |
| using | size_type = std::size_t |
| Type alias for size type. | |
| using | difference_type = std::ptrdiff_t |
| Type alias for difference type. | |
| using | reference = T& |
| Type alias for reference to element. | |
| using | const_reference = const T& |
| Type alias for const reference to element. | |
| using | pointer = T* |
| Type alias for pointer to element. | |
| using | const_pointer = const T* |
| Type alias for const pointer to element. | |
Public Member Functions | |
| StackVector () noexcept | |
| Default constructor. | |
| StackVector (std::initializer_list< T > init) | |
| Construct from initializer list. | |
| StackVector (const StackVector &other) | |
| Copy constructor. | |
| StackVector (StackVector &&other) noexcept | |
| Move constructor. | |
| ~StackVector () noexcept | |
| Destructor. | |
| StackVector & | operator= (const StackVector &other) |
| Copy assignment operator. | |
| StackVector & | operator= (StackVector &&other) noexcept |
| Move assignment operator. | |
| bool | operator== (const StackVector &other) const noexcept |
| Equality comparison operator. | |
| bool | operator!= (const StackVector &other) const noexcept |
| Inequality comparison operator. | |
| void | push_back (const T &value) |
| Add element to end (copy). | |
| void | push_back (T &&value) |
| Add element to end (move). | |
| template<typename... Args> | |
| void | emplace_back (Args &&... args) |
| Construct element in-place at end. | |
| reference | operator[] (size_type pos) noexcept |
| Access element at position (no bounds checking). | |
| const_reference | operator[] (size_type pos) const noexcept |
| Access element at position (no bounds checking) const. | |
| reference | at (size_type pos) |
| Access element at position (with bounds checking). | |
| const_reference | at (size_type pos) const |
| Access element at position (with bounds checking) const. | |
| reference | back () noexcept |
| Access last element. | |
| const_reference | back () const noexcept |
| Access last element const. | |
| reference | front () noexcept |
| Access first element. | |
| const_reference | front () const noexcept |
| Access first element const. | |
| StackVector< T, N >::size_type | size () const noexcept |
| Get number of elements. | |
| bool | isEmpty () const noexcept |
| Check if container is empty. | |
| size_type | capacity () const noexcept |
| Get current capacity. | |
| void | resize (size_type count) |
| Resize container to specified size. | |
| void | resize (size_type count, const T &value) |
| Resize container to specified size with default value. | |
| void | reserve (size_type newCapacity) |
| Reserve storage for at least specified capacity. | |
| pointer | data () noexcept |
| Get pointer to underlying data. | |
| const_pointer | data () const noexcept |
| Get const pointer to underlying data. | |
| pointer | begin () noexcept |
| Get iterator to beginning. | |
| const_pointer | begin () const noexcept |
| Get const iterator to beginning. | |
| pointer | end () noexcept |
| Get iterator to end. | |
| const_pointer | end () const noexcept |
| Get const iterator to end. | |
| const_pointer | cbegin () const noexcept |
| Get const iterator to beginning. | |
| const_pointer | cend () const noexcept |
| Get const iterator to end. | |
| void | clear () noexcept |
| Clear all elements. | |
| void | pop_back () noexcept |
| Remove last element. | |
Vector with stack storage optimization.
| T | Element type |
| N | Maximum number of elements to store on stack before heap allocation |
Stores up to N elements on the stack for optimal cache locality and zero heap allocations. Automatically transitions to heap storage when size exceeds N.
Definition at line 54 of file StackVector.h.
| using nfx::containers::StackVector< T, N >::const_pointer = const T* |
Type alias for const pointer to element.
Definition at line 80 of file StackVector.h.
| using nfx::containers::StackVector< T, N >::const_reference = const T& |
Type alias for const reference to element.
Definition at line 74 of file StackVector.h.
| using nfx::containers::StackVector< T, N >::difference_type = std::ptrdiff_t |
Type alias for difference type.
Definition at line 68 of file StackVector.h.
| using nfx::containers::StackVector< T, N >::pointer = T* |
Type alias for pointer to element.
Definition at line 77 of file StackVector.h.
| using nfx::containers::StackVector< T, N >::reference = T& |
Type alias for reference to element.
Definition at line 71 of file StackVector.h.
| using nfx::containers::StackVector< T, N >::size_type = std::size_t |
Type alias for size type.
Definition at line 65 of file StackVector.h.
| using nfx::containers::StackVector< T, N >::value_type = T |
Type alias for element type.
Definition at line 62 of file StackVector.h.
|
inline |
Construct from initializer list.
| init | Initializer list of elements |
|
inline |
Copy constructor.
| other | The StackVector to copy from |
|
inlinenoexcept |
Move constructor.
| other | The StackVector to move from |
|
inline |
Access element at position (with bounds checking).
| pos | Position of element |
| std::out_of_range | if pos >= size() |
|
inline |
Access element at position (with bounds checking) const.
| pos | Position of element |
| std::out_of_range | if pos >= size() |
|
inlinenoexcept |
Access last element const.
|
inlinenoexcept |
Access last element.
|
inlinenoexcept |
Get const iterator to beginning.
|
inlinenoexcept |
Get iterator to beginning.
|
inlinenoexcept |
Get current capacity.
|
inlinenoexcept |
Get const iterator to beginning.
|
inlinenoexcept |
Get const iterator to end.
|
inlinenoexcept |
Get const pointer to underlying data.
|
inlinenoexcept |
Get pointer to underlying data.
|
inline |
Construct element in-place at end.
| Args | Types of arguments to forward to constructor |
| args | Arguments to forward to element constructor |
|
inlinenoexcept |
Get const iterator to end.
|
inlinenoexcept |
Get iterator to end.
|
inlinenoexcept |
Access first element const.
|
inlinenoexcept |
Access first element.
|
inlinenoexcept |
Check if container is empty.
|
inlinenoexcept |
Inequality comparison operator.
| other | The StackVector to compare with |
|
inline |
Copy assignment operator.
| other | The StackVector to copy from |
|
inlinenoexcept |
Move assignment operator.
| other | The StackVector to move from |
|
inlinenoexcept |
Equality comparison operator.
| other | The StackVector to compare with |
|
inlinenoexcept |
Access element at position (no bounds checking) const.
| pos | Position of element |
|
inlinenoexcept |
Access element at position (no bounds checking).
| pos | Position of element |
|
inline |
Add element to end (copy).
| value | The element to add |
|
inline |
Add element to end (move).
| value | The element to add |
|
inline |
Reserve storage for at least specified capacity.
| newCapacity | Minimum capacity to reserve |
|
inline |
Resize container to specified size.
| count | New size |
|
inline |
Resize container to specified size with default value.
| count | New size |
| value | Value to initialize new elements with |
|
inlinenoexcept |
Get number of elements.