Open 3D Engine AzCore API Reference  22.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Types | Public Member Functions | Static Public Member Functions | List of all members
AZStd::fixed_vector< T, Capacity > Class Template Reference

#include <fixed_vector.h>

Public Types

using value_type = typename base_type::value_type
 
using difference_type = typename base_type::difference_type
 
using pointer = typename base_type::pointer
 
using const_pointer = typename base_type::const_pointer
 
using reference = typename base_type::reference
 
using const_reference = typename base_type::const_reference
 
using iterator = typename base_type::pointer
 
using const_iterator = typename base_type::const_pointer
 
using size_type = size_t
 
using reverse_iterator = AZStd::reverse_iterator< iterator >
 
using const_reverse_iterator = AZStd::reverse_iterator< const_iterator >
 
using node_type = value_type
 

Public Member Functions

 fixed_vector (size_type numElements, const_reference value=value_type())
 
template<class InputIt , typename = AZStd::enable_if_t<input_iterator<InputIt>>>
 fixed_vector (InputIt first, InputIt last)
 
 fixed_vector (const fixed_vector &rhs)
 
 fixed_vector (fixed_vector &&rhs)
 
template<class R , class = enable_if_t<Internal::container_compatible_range<R, value_type>>>
 fixed_vector (from_range_t, R &&rg)
 
 fixed_vector (AZStd::initializer_list< value_type > ilist)
 
fixed_vectoroperator= (const fixed_vector &rhs)
 
fixed_vectoroperator= (fixed_vector &&rhs)
 
template<typename R >
AZStd::enable_if_t<!AZStd::is_same_v< AZStd::remove_cvref_t< R >, fixed_vector >, fixed_vector > & operator= (R &&rhs)
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator crbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
const_reverse_iterator crend () const
 
template<class R >
auto append_range (R &&rg) -> enable_if_t< Internal::container_compatible_range< R, T >>
 
size_type size () const noexcept
 
void resize (size_type newSize)
 
void resize (size_type newSize, const_reference value)
 
void reserve (size_type newCapacity)
 
void shrink_to_fit ()
 
reference at (size_type position)
 
const_reference at (size_type position) const
 
reference operator[] (size_type position)
 
const_reference operator[] (size_type position) const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
void push_back (const_reference value)
 
void assign (size_type numElements, const_reference value)
 
template<class InputIt , typename = AZStd::enable_if_t<input_iterator<InputIt>>>
void assign (InputIt first, InputIt last)
 
void assign (AZStd::initializer_list< value_type > ilist)
 
template<typename R >
auto assign_range (R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type >>
 
template<typename... Args, typename = AZStd::enable_if_t<is_constructible_v<T, Args...>>>
iterator emplace (const_iterator insertPos, Args &&... args)
 
iterator insert (const_iterator insertPos, const_reference value)
 
iterator insert (const_iterator insertPos, value_type &&value)
 
void insert (const_iterator insertPos, size_type numElements, const_reference value)
 
template<class InputIt >
auto insert (const_iterator insertPos, InputIt first, InputIt last) -> enable_if_t< input_iterator< InputIt >, iterator >
 
template<class R >
auto insert_range (const_iterator insertPos, R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type >, iterator >
 
iterator insert (const_iterator insertPos, initializer_list< value_type > ilist)
 
iterator erase (const_iterator elementIter)
 
iterator erase (const_iterator first, const_iterator last)
 
void clear ()
 
void swap (fixed_vector &rhs)
 
bool validate () const
 
int validate_iterator (const_iterator iter) const
 
void leak_and_reset ()
 

Static Public Member Functions

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

Detailed Description

template<class T, AZStd::size_t Capacity>
class AZStd::fixed_vector< T, Capacity >

This is the fixed capacity version of the AZStd::vector. All of the functionality is the same except we do not have allocator and never allocate memory. We can not change the capacity, it is set at compile time. leak_and_reset function just does the reset part, no destructor is called.

Note
Although big parts of the code is the same with vector, we do have separate implementation. This class is made to be constexpr friendly - That being said it requires C++20 support in order to allow constexpr in methods which invokes placement new and non-trivial destructors Check the fixed_vector AZStdExamples.

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