1.10
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...

#include <fixedvector.h>

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.
 
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

template<typename T , std::size_t Capacity = 5>
using const_iterator = T const*

◆ const_pointer

template<typename T , std::size_t Capacity = 5>
using const_pointer = T const*

◆ const_reference

template<typename T , std::size_t Capacity = 5>
using const_reference = value_type const&

◆ const_reverse_iterator

template<typename T , std::size_t Capacity = 5>
using const_reverse_iterator = ::std::reverse_iterator<const_iterator>

◆ difference_type

template<typename T , std::size_t Capacity = 5>
using difference_type = std::ptrdiff_t

◆ iterator

template<typename T , std::size_t Capacity = 5>
using iterator = T*

◆ pointer

template<typename T , std::size_t Capacity = 5>
using pointer = T*

◆ reference

template<typename T , std::size_t Capacity = 5>
using reference = value_type&

◆ reverse_iterator

template<typename T , std::size_t Capacity = 5>
using reverse_iterator = ::std::reverse_iterator<iterator>

◆ size_type

template<typename T , std::size_t Capacity = 5>
using size_type = size_t

◆ value_type

template<typename T , std::size_t Capacity = 5>
using value_type = T

Constructor & Destructor Documentation

◆ FixedVector() [1/4]

template<typename T , std::size_t Capacity = 5>
template<typename I >
constexpr FixedVector ( begin,
const I &  end 
)
inlineconstexprnoexcept

◆ FixedVector() [2/4]

template<typename T , std::size_t Capacity = 5>
constexpr FixedVector ( size_type  count,
const T &  value 
)
inlineconstexprnoexcept

◆ FixedVector() [3/4]

template<typename T , std::size_t Capacity = 5>
constexpr FixedVector ( std::initializer_list< T >  init)
inlineconstexprnoexcept

◆ FixedVector() [4/4]

template<typename T , std::size_t Capacity = 5>
constexpr FixedVector ( )
constexprdefault

Member Function Documentation

◆ at() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr reference at ( size_type  pos)
inlineconstexpr

◆ at() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_reference at ( size_type  pos) const
inlineconstexpr

◆ back() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_reference back ( ) const
inlineconstexprnoexcept

◆ back() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr reference back ( )
inlineconstexprnoexcept

◆ begin() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_iterator begin ( ) const
inlineconstexprnoexcept

◆ begin() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr iterator begin ( )
inlineconstexprnoexcept

◆ capacity()

template<typename T , std::size_t Capacity = 5>
constexpr auto capacity ( ) const
inlineconstexprnoexcept

◆ cbegin() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_iterator cbegin ( ) const
inlineconstexprnoexcept

◆ cbegin() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_iterator cbegin ( )
inlineconstexprnoexcept

◆ cend() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_iterator cend ( ) const
inlineconstexprnoexcept

◆ cend() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_iterator cend ( )
inlineconstexprnoexcept

◆ clear()

template<typename T , std::size_t Capacity = 5>
constexpr void clear ( )
inlineconstexprnoexcept

◆ data()

template<typename T , std::size_t Capacity = 5>
constexpr const T * data ( ) const
inlineconstexpr

◆ emplace_back()

template<typename T , std::size_t Capacity = 5>
template<typename... Args>
void emplace_back ( Args &&...  args)
inlinenoexcept

◆ empty()

template<typename T , std::size_t Capacity = 5>
constexpr auto empty ( ) const
inlineconstexprnoexcept

◆ end() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_iterator end ( ) const
inlineconstexprnoexcept

◆ end() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr iterator end ( )
inlineconstexprnoexcept

◆ erase() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr iterator erase ( const_iterator  first,
const_iterator  last 
)
inlineconstexprnoexcept

◆ erase() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr iterator erase ( const_iterator  position)
inlineconstexprnoexcept

◆ front() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_reference front ( ) const
inlineconstexprnoexcept

◆ front() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr reference front ( )
inlineconstexprnoexcept

◆ operator[]() [1/2]

template<typename T , std::size_t Capacity = 5>
constexpr const_reference operator[] ( size_type  pos) const
inlineconstexprnoexcept

◆ operator[]() [2/2]

template<typename T , std::size_t Capacity = 5>
constexpr reference operator[] ( size_type  pos)
inlineconstexprnoexcept

◆ push_back() [1/2]

template<typename T , std::size_t Capacity = 5>
void push_back ( )
inlinenoexcept

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

◆ push_back() [2/2]

template<typename T , std::size_t Capacity = 5>
template<typename U >
constexpr void push_back ( U &&  value)
inlineconstexprnoexcept

◆ rbegin() [1/2]

template<typename T , std::size_t Capacity = 5>
const_reverse_iterator rbegin ( ) const
inlinenoexcept

◆ rbegin() [2/2]

template<typename T , std::size_t Capacity = 5>
reverse_iterator rbegin ( )
inlinenoexcept

◆ rend() [1/2]

template<typename T , std::size_t Capacity = 5>
const_reverse_iterator rend ( ) const
inlinenoexcept

◆ rend() [2/2]

template<typename T , std::size_t Capacity = 5>
reverse_iterator rend ( )
inlinenoexcept

◆ size()

template<typename T , std::size_t Capacity = 5>
constexpr auto size ( ) const
inlineconstexprnoexcept

◆ swap()

template<typename T , std::size_t Capacity = 5>
constexpr void swap ( FixedVector< T, Capacity > &  other)
inlineconstexprnoexcept