37#include <initializer_list>
44namespace nfx::containers
53 template <
typename T, std::
size_t N = 8>
126 inline
bool operator==( const
StackVector& other ) const noexcept;
133 inline
bool operator!=( const
StackVector& other ) const noexcept;
152 template <typename... Args>
306 inline
void transitionToHeap();
309 inline T* stackData() noexcept;
312 inline const T* stackData() const noexcept;
315 inline std::vector<T>& heapData() noexcept;
318 inline const std::vector<T>& heapData() const noexcept;
320 union alignas( alignof( T ) > alignof( std::vector<T> ) ? alignof( T ) : alignof( std::vector<T> ) )
322 unsigned char m_stackStorage[N *
sizeof( T )];
323 unsigned char m_heapStorage[
sizeof( std::vector<T> )];
331#include "nfx/detail/containers/StackVector.inl"
T value_type
Type alias for element type.
reference back() noexcept
Access last element.
void emplace_back(Args &&... args)
Construct element in-place at end.
reference at(size_type pos)
Access element at position (with bounds checking).
const T * const_pointer
Type alias for const pointer to element.
const_pointer cend() const noexcept
Get const iterator to end.
void resize(size_type count)
Resize container to specified size.
size_type capacity() const noexcept
Get current capacity.
void push_back(const T &value)
Add element to end (copy).
pointer begin() noexcept
Get iterator to beginning.
void clear() noexcept
Clear all elements.
void reserve(size_type newCapacity)
Reserve storage for at least specified capacity.
T & reference
Type alias for reference to element.
std::size_t size_type
Type alias for size type.
StackVector() noexcept
Default constructor.
T * pointer
Type alias for pointer to element.
pointer data() noexcept
Get pointer to underlying data.
void pop_back() noexcept
Remove last element.
StackVector< T, N >::size_type size() const noexcept
Get number of elements.
const_pointer cbegin() const noexcept
Get const iterator to beginning.
reference front() noexcept
Access first element.
const T & const_reference
Type alias for const reference to element.
std::ptrdiff_t difference_type
Type alias for difference type.
bool isEmpty() const noexcept
Check if container is empty.
pointer end() noexcept
Get iterator to end.