Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
static_vector< T, MaxSize > Class Template Reference

A fixed-capacity vector with stack storage and std::vector-like API. More...

#include <static_vector.hpp>

Public Types

using const_iterator = T const *
 
using const_pointer = T const *
 
using const_reference = T const &
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using difference_type = std::ptrdiff_t
 
using iterator = T *
 
using pointer = T *
 
using reference = T &
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using size_type = std::size_t
 
using value_type = T
 

Public Member Functions

reference at (size_type pos)
 Bounds-checked element access.
 
const_reference at (size_type pos) const
 
reference back ()
 
const_reference back () const
 
const_iterator begin () const noexcept
 
iterator begin () noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
void clear () noexcept
 Destroy all elements and reset size to zero.
 
const_reverse_iterator crbegin () const noexcept
 
const_reverse_iterator crend () const noexcept
 
const_pointer data () const noexcept
 
pointer data () noexcept
 
template<class... Args>
void emplace_back (Args &&... args)
 Construct a new element in-place at the end.
 
bool empty () const noexcept
 
const_iterator end () const noexcept
 
iterator end () noexcept
 
reference front ()
 
const_reference front () const
 
static_vector & operator= (static_vector &&o) noexcept(std::is_nothrow_move_assignable< T >::value)
 Move assignment.
 
static_vector & operator= (static_vector const &o)
 Copy assignment.
 
static_vector & operator= (std::initializer_list< T > init)
 Assign from an initializer list.
 
reference operator[] (size_type pos)
 
const_reference operator[] (size_type pos) const
 
void pop_back ()
 Remove the last element.
 
void push_back (T &&value)
 Append a new moved value to the end.
 
void push_back (T const &value)
 Append a new copy of value to the end.
 
const_reverse_iterator rbegin () const noexcept
 
reverse_iterator rbegin () noexcept
 
const_reverse_iterator rend () const noexcept
 
reverse_iterator rend () noexcept
 
void resize (size_type count)
 Resize the vector to count elements.
 
size_type size () const noexcept
 
 static_vector () noexcept
 Default-construct an empty static_vector.
 
 static_vector (size_type count)
 Construct with count default-initialized elements.
 
 static_vector (size_type count, T const &value)
 Construct with count copies of value.
 
 static_vector (static_vector &&o) noexcept(std::is_nothrow_move_constructible< T >::value)
 Move constructor.
 
 static_vector (static_vector const &o)
 Copy constructor.
 
 static_vector (std::initializer_list< T > init)
 Construct from an initializer list.
 
void swap (static_vector &other) noexcept(std::is_nothrow_swappable< T >::value)
 Swap contents with another static_vector.
 
 ~static_vector ()
 Destructor. Destroys all elements in-place.
 

Static Public Member Functions

static constexpr size_type capacity () noexcept
 
static constexpr size_type max_size () noexcept
 

Detailed Description

template<typename T, std::size_t MaxSize>
class static_vector< T, MaxSize >

A fixed-capacity vector with stack storage and std::vector-like API.

Template Parameters
TElement type
MaxSizeMaximum number of elements (capacity, fixed at compile time)

Member Typedef Documentation

◆ const_iterator

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::const_iterator = T const*

◆ const_pointer

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::const_pointer = T const*

◆ const_reference

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::const_reference = T const&

◆ const_reverse_iterator

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::const_reverse_iterator = std::reverse_iterator<const_iterator>

◆ difference_type

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::difference_type = std::ptrdiff_t

◆ iterator

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::iterator = T*

◆ pointer

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::pointer = T*

◆ reference

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::reference = T&

◆ reverse_iterator

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::reverse_iterator = std::reverse_iterator<iterator>

◆ size_type

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::size_type = std::size_t

◆ value_type

template<typename T , std::size_t MaxSize>
using static_vector< T, MaxSize >::value_type = T

Constructor & Destructor Documentation

◆ static_vector() [1/6]

template<typename T , std::size_t MaxSize>
static_vector< T, MaxSize >::static_vector ( )
inlinenoexcept

Default-construct an empty static_vector.

◆ static_vector() [2/6]

template<typename T , std::size_t MaxSize>
static_vector< T, MaxSize >::static_vector ( size_type  count)
inlineexplicit

Construct with count default-initialized elements.

Precondition
count <= MaxSize

◆ static_vector() [3/6]

template<typename T , std::size_t MaxSize>
static_vector< T, MaxSize >::static_vector ( size_type  count,
T const &  value 
)
inline

Construct with count copies of value.

◆ static_vector() [4/6]

template<typename T , std::size_t MaxSize>
static_vector< T, MaxSize >::static_vector ( std::initializer_list< T >  init)
inline

Construct from an initializer list.

◆ static_vector() [5/6]

template<typename T , std::size_t MaxSize>
static_vector< T, MaxSize >::static_vector ( static_vector< T, MaxSize > const &  o)
inline

Copy constructor.

◆ static_vector() [6/6]

template<typename T , std::size_t MaxSize>
static_vector< T, MaxSize >::static_vector ( static_vector< T, MaxSize > &&  o)
inlinenoexcept

Move constructor.

◆ ~static_vector()

template<typename T , std::size_t MaxSize>
static_vector< T, MaxSize >::~static_vector ( )
inline

Destructor. Destroys all elements in-place.

Member Function Documentation

◆ at() [1/2]

template<typename T , std::size_t MaxSize>
reference static_vector< T, MaxSize >::at ( size_type  pos)
inline

Bounds-checked element access.

◆ at() [2/2]

template<typename T , std::size_t MaxSize>
const_reference static_vector< T, MaxSize >::at ( size_type  pos) const
inline

◆ back() [1/2]

template<typename T , std::size_t MaxSize>
reference static_vector< T, MaxSize >::back ( )
inline

◆ back() [2/2]

template<typename T , std::size_t MaxSize>
const_reference static_vector< T, MaxSize >::back ( ) const
inline

◆ begin() [1/2]

template<typename T , std::size_t MaxSize>
const_iterator static_vector< T, MaxSize >::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

template<typename T , std::size_t MaxSize>
iterator static_vector< T, MaxSize >::begin ( )
inlinenoexcept

◆ capacity()

template<typename T , std::size_t MaxSize>
static constexpr size_type static_vector< T, MaxSize >::capacity ( )
inlinestaticconstexprnoexcept

◆ cbegin()

template<typename T , std::size_t MaxSize>
const_iterator static_vector< T, MaxSize >::cbegin ( ) const
inlinenoexcept

◆ cend()

template<typename T , std::size_t MaxSize>
const_iterator static_vector< T, MaxSize >::cend ( ) const
inlinenoexcept

◆ clear()

template<typename T , std::size_t MaxSize>
void static_vector< T, MaxSize >::clear ( )
inlinenoexcept

Destroy all elements and reset size to zero.

◆ crbegin()

template<typename T , std::size_t MaxSize>
const_reverse_iterator static_vector< T, MaxSize >::crbegin ( ) const
inlinenoexcept

◆ crend()

template<typename T , std::size_t MaxSize>
const_reverse_iterator static_vector< T, MaxSize >::crend ( ) const
inlinenoexcept

◆ data() [1/2]

template<typename T , std::size_t MaxSize>
const_pointer static_vector< T, MaxSize >::data ( ) const
inlinenoexcept

◆ data() [2/2]

template<typename T , std::size_t MaxSize>
pointer static_vector< T, MaxSize >::data ( )
inlinenoexcept

◆ emplace_back()

template<typename T , std::size_t MaxSize>
template<class... Args>
void static_vector< T, MaxSize >::emplace_back ( Args &&...  args)
inline

Construct a new element in-place at the end.

◆ empty()

template<typename T , std::size_t MaxSize>
bool static_vector< T, MaxSize >::empty ( ) const
inlinenoexcept

◆ end() [1/2]

template<typename T , std::size_t MaxSize>
const_iterator static_vector< T, MaxSize >::end ( ) const
inlinenoexcept

◆ end() [2/2]

template<typename T , std::size_t MaxSize>
iterator static_vector< T, MaxSize >::end ( )
inlinenoexcept

◆ front() [1/2]

template<typename T , std::size_t MaxSize>
reference static_vector< T, MaxSize >::front ( )
inline

◆ front() [2/2]

template<typename T , std::size_t MaxSize>
const_reference static_vector< T, MaxSize >::front ( ) const
inline

◆ max_size()

template<typename T , std::size_t MaxSize>
static constexpr size_type static_vector< T, MaxSize >::max_size ( )
inlinestaticconstexprnoexcept

◆ operator=() [1/3]

template<typename T , std::size_t MaxSize>
static_vector & static_vector< T, MaxSize >::operator= ( static_vector< T, MaxSize > &&  o)
inlinenoexcept

Move assignment.

◆ operator=() [2/3]

template<typename T , std::size_t MaxSize>
static_vector & static_vector< T, MaxSize >::operator= ( static_vector< T, MaxSize > const &  o)
inline

Copy assignment.

◆ operator=() [3/3]

template<typename T , std::size_t MaxSize>
static_vector & static_vector< T, MaxSize >::operator= ( std::initializer_list< T >  init)
inline

Assign from an initializer list.

◆ operator[]() [1/2]

template<typename T , std::size_t MaxSize>
reference static_vector< T, MaxSize >::operator[] ( size_type  pos)
inline

◆ operator[]() [2/2]

template<typename T , std::size_t MaxSize>
const_reference static_vector< T, MaxSize >::operator[] ( size_type  pos) const
inline

◆ pop_back()

template<typename T , std::size_t MaxSize>
void static_vector< T, MaxSize >::pop_back ( )
inline

Remove the last element.

◆ push_back() [1/2]

template<typename T , std::size_t MaxSize>
void static_vector< T, MaxSize >::push_back ( T &&  value)
inline

Append a new moved value to the end.

◆ push_back() [2/2]

template<typename T , std::size_t MaxSize>
void static_vector< T, MaxSize >::push_back ( T const &  value)
inline

Append a new copy of value to the end.

◆ rbegin() [1/2]

template<typename T , std::size_t MaxSize>
const_reverse_iterator static_vector< T, MaxSize >::rbegin ( ) const
inlinenoexcept

◆ rbegin() [2/2]

template<typename T , std::size_t MaxSize>
reverse_iterator static_vector< T, MaxSize >::rbegin ( )
inlinenoexcept

◆ rend() [1/2]

template<typename T , std::size_t MaxSize>
const_reverse_iterator static_vector< T, MaxSize >::rend ( ) const
inlinenoexcept

◆ rend() [2/2]

template<typename T , std::size_t MaxSize>
reverse_iterator static_vector< T, MaxSize >::rend ( )
inlinenoexcept

◆ resize()

template<typename T , std::size_t MaxSize>
void static_vector< T, MaxSize >::resize ( size_type  count)
inline

Resize the vector to count elements.

◆ size()

template<typename T , std::size_t MaxSize>
size_type static_vector< T, MaxSize >::size ( ) const
inlinenoexcept

◆ swap()

template<typename T , std::size_t MaxSize>
void static_vector< T, MaxSize >::swap ( static_vector< T, MaxSize > &  other)
inlinenoexcept

Swap contents with another static_vector.


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