jubilant-funicular
Public Types | Public Member Functions | Private Attributes | List of all members
nta::utils::StaticVector< T, Cap > Class Template Reference

#include <StaticVector.h>

Collaboration diagram for nta::utils::StaticVector< T, Cap >:
Collaboration graph
[legend]

Public Types

using value_type = T
 
using iterator = T *
 
using const_iterator = const T *
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

template<std::size_t Cap2>
 StaticVector (const StaticVector< T, Cap2 > &other)
 
template<std::size_t Cap2>
 StaticVector (StaticVector< T, Cap2 > &&other)
 
 StaticVector (std::size_t count, const T &value=T())
 
 StaticVector (const std::initializer_list< T > &data)
 
constexpr std::size_t capacity () const
 
constexpr std::size_t cap () const
 
constexpr std::size_t max_size () const
 
std::size_t size () const
 
bool is_empty () const
 
bool empty () const
 
bool is_full () const
 
bool full () const
 
T & front ()
 
T & back ()
 
T * data ()
 
T & operator[] (std::size_t idx)
 
T & at (std::size_t idx)
 
void clear ()
 
void pop_back ()
 
void erase (iterator pos)
 
void resize (std::size_t size)
 
void remove (iterator pos)
 
void push_back (const T &elem)
 
template<typename... Args>
void emplace_back (Args &&... args)
 
void insert (iterator pos, const T &elem)
 
template<typename... Args>
void emplace (iterator pos, Args &&... args)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
const_reverse_iterator crbegin ()
 
const_reverse_iterator crend ()
 

Private Attributes

std::aligned_storage_t< sizeof(T), alignof(T)> m_data [Cap]
 
std::size_t m_size
 

Detailed Description

template<typename T, std::size_t Cap>
class nta::utils::StaticVector< T, Cap >

A (fixed capacity) vector with data stored on the stack instead of the heap.

Currently does no error checking, so use carefully.

Definition at line 15 of file StaticVector.h.


The documentation for this class was generated from the following file: