1.2
Public Types | Public Member Functions | List of all members
FixedVector< T, Capacity > Class Template Reference

constexpr vector that tries to behave like, or have an API like, std::vector. More...

Public Types

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

Public Member Functions

constexpr FixedVector ()=default
 
template<typename I >
constexpr FixedVector (I begin, const I &end) noexcept
 
constexpr FixedVector (size_type count, const T &value) noexcept
 
constexpr FixedVector (std::initializer_list< T > init) noexcept
 
constexpr reference at (size_type pos)
 
constexpr const_reference at (size_type pos) const
 
constexpr const_reference back () const noexcept
 
constexpr reference back () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr auto capacity () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cbegin () noexcept
 
constexpr const_iterator cend () const noexcept
 
constexpr const_iterator cend () noexcept
 
constexpr void clear () noexcept
 
constexpr const T * data () const
 
template<typename... Args>
void emplace_back (Args &&... args) noexcept
 
constexpr auto empty () const noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr iterator end () noexcept
 
constexpr iterator erase (const_iterator first, const_iterator last) noexcept
 
constexpr iterator erase (const_iterator position) noexcept
 
constexpr const_reference front () const noexcept
 
constexpr reference front () noexcept
 
constexpr const_reference operator[] (size_type pos) const noexcept
 
constexpr reference operator[] (size_type pos) noexcept
 
void push_back () noexcept
 Appends a default constructed T at the end of the FixedVector. More...
 
template<typename U >
constexpr void push_back (U &&value) noexcept
 
const_reverse_iterator rbegin () const noexcept
 
reverse_iterator rbegin () noexcept
 
const_reverse_iterator rend () const noexcept
 
reverse_iterator rend () noexcept
 
constexpr auto size () const noexcept
 
constexpr void swap (FixedVector &other) noexcept
 

Detailed Description

template<typename T, std::size_t Capacity = 5>
class egt::v1::FixedVector< T, Capacity >

constexpr vector that tries to behave like, or have an API like, std::vector.

The capacity is fixed at compile time with the capacity template parameter. Exceeding this capacity will throw an exception. Otherwise, the vector can be resized as necessary.

Member Typedef Documentation

◆ const_iterator

using const_iterator = T const*

◆ const_pointer

using const_pointer = T const*

◆ const_reference

using const_reference = value_type const&

◆ const_reverse_iterator

using const_reverse_iterator = ::std::reverse_iterator<const_iterator>

◆ difference_type

using difference_type = std::ptrdiff_t

◆ iterator

using iterator = T*

◆ pointer

using pointer = T*

◆ reference

◆ reverse_iterator

using reverse_iterator = ::std::reverse_iterator<iterator>

◆ size_type

using size_type = size_t

◆ value_type

using value_type = T

Constructor & Destructor Documentation

◆ FixedVector() [1/4]

constexpr FixedVector ( begin,
const I &  end 
)
inlineconstexprnoexcept

◆ FixedVector() [2/4]

constexpr FixedVector ( size_type  count,
const T &  value 
)
inlineconstexprnoexcept

◆ FixedVector() [3/4]

constexpr FixedVector ( std::initializer_list< T >  init)
inlineconstexprnoexcept

◆ FixedVector() [4/4]

constexpr FixedVector ( )
constexprdefault

Member Function Documentation

◆ at() [1/2]

constexpr reference at ( size_type  pos)
inlineconstexpr

◆ at() [2/2]

constexpr const_reference at ( size_type  pos) const
inlineconstexpr

◆ back() [1/2]

constexpr const_reference back ( ) const
inlineconstexprnoexcept

◆ back() [2/2]

constexpr reference back ( )
inlineconstexprnoexcept

◆ begin() [1/2]

constexpr const_iterator begin ( ) const
inlineconstexprnoexcept

◆ begin() [2/2]

constexpr iterator begin ( )
inlineconstexprnoexcept

◆ capacity()

constexpr auto capacity ( ) const
inlineconstexprnoexcept

◆ cbegin() [1/2]

constexpr const_iterator cbegin ( ) const
inlineconstexprnoexcept

◆ cbegin() [2/2]

constexpr const_iterator cbegin ( )
inlineconstexprnoexcept

◆ cend() [1/2]

constexpr const_iterator cend ( ) const
inlineconstexprnoexcept

◆ cend() [2/2]

constexpr const_iterator cend ( )
inlineconstexprnoexcept

◆ clear()

constexpr void clear ( )
inlineconstexprnoexcept

◆ data()

constexpr const T* data ( ) const
inlineconstexpr

◆ emplace_back()

void emplace_back ( Args &&...  args)
inlinenoexcept

◆ empty()

constexpr auto empty ( ) const
inlineconstexprnoexcept

◆ end() [1/2]

constexpr const_iterator end ( ) const
inlineconstexprnoexcept

◆ end() [2/2]

constexpr iterator end ( )
inlineconstexprnoexcept

◆ erase() [1/2]

constexpr iterator erase ( const_iterator  first,
const_iterator  last 
)
inlineconstexprnoexcept

◆ erase() [2/2]

constexpr iterator erase ( const_iterator  position)
inlineconstexprnoexcept

◆ front() [1/2]

constexpr const_reference front ( ) const
inlineconstexprnoexcept

◆ front() [2/2]

constexpr reference front ( )
inlineconstexprnoexcept

◆ operator[]() [1/2]

constexpr const_reference operator[] ( size_type  pos) const
inlineconstexprnoexcept

◆ operator[]() [2/2]

constexpr reference operator[] ( size_type  pos)
inlineconstexprnoexcept

◆ push_back() [1/2]

void push_back ( )
inlinenoexcept

Appends a default constructed T at the end of the FixedVector.

◆ push_back() [2/2]

constexpr void push_back ( U &&  value)
inlineconstexprnoexcept

◆ rbegin() [1/2]

const_reverse_iterator rbegin ( ) const
inlinenoexcept

◆ rbegin() [2/2]

reverse_iterator rbegin ( )
inlinenoexcept

◆ rend() [1/2]

const_reverse_iterator rend ( ) const
inlinenoexcept

◆ rend() [2/2]

reverse_iterator rend ( )
inlinenoexcept

◆ size()

constexpr auto size ( ) const
inlineconstexprnoexcept

◆ swap()

constexpr void swap ( FixedVector< T, Capacity > &  other)
inlineconstexprnoexcept