Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
A conntainer close to std::vector but the elements are stored in place: There is a fixed capacity and there is no dynamic memory allocation. More...
#include <StaticVector.h>
Public Types | |
using | value_type = T |
using | size_type = decltype(MakeSmallestCapableUnsigned< N >()) |
using | difference_type = decltype(MakeSmallestCapableSigned< N >()) |
using | reference = value_type & |
using | const_reference = const value_type & |
using | pointer = value_type * |
using | const_pointer = const value_type * |
using | iterator = pointer |
using | const_iterator = const_pointer |
using | reverse_iterator = std::reverse_iterator< iterator > |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
Public Member Functions | |
StaticVector ()=default | |
StaticVector (const StaticVector &other) noexcept(std::is_nothrow_copy_constructible_v< T >) | |
template<size_t OtherN> | |
StaticVector (const StaticVector< T, OtherN > &other) noexcept(std::is_nothrow_copy_constructible_v< T >) | |
StaticVector & | operator= (const StaticVector &other) noexcept(std::is_nothrow_copy_constructible_v< T > &&std::is_nothrow_copy_assignable_v< T >) |
template<size_t OtherN> | |
StaticVector & | operator= (const StaticVector< T, OtherN > &other) noexcept(std::is_nothrow_copy_constructible_v< T > &&std::is_nothrow_copy_assignable_v< T >) |
StaticVector (StaticVector &&other) noexcept(std::is_nothrow_move_constructible_v< T >) | |
template<size_t OtherN> | |
StaticVector (StaticVector< T, OtherN > &&other) noexcept(std::is_nothrow_move_constructible_v< T >) | |
StaticVector & | operator= (StaticVector &&other) noexcept(std::is_nothrow_move_constructible_v< T > &&std::is_nothrow_move_assignable_v< T >) |
template<size_t OtherN> | |
StaticVector & | operator= (StaticVector< T, OtherN > &&other) noexcept(std::is_nothrow_move_constructible_v< T > &&std::is_nothrow_move_assignable_v< T >) |
~StaticVector () | |
StaticVector (const size_type count, const T &value) | |
StaticVector (const size_type count) | |
StaticVector (const std::initializer_list< T > init) | |
StaticVector & | operator= (const std::initializer_list< T > init) |
reference | at (const size_type index) |
const_reference | at (const size_type index) const |
reference | operator[] (const size_type index) noexcept |
const_reference | operator[] (const size_type index) const noexcept |
reference | front () noexcept |
const_reference | front () const noexcept |
reference | back () noexcept |
const_reference | back () const noexcept |
pointer | data () noexcept |
const_pointer | data () const noexcept |
iterator | begin () noexcept |
const_iterator | begin () const noexcept |
const_iterator | cbegin () const noexcept |
iterator | end () noexcept |
const_iterator | end () const noexcept |
const_iterator | cend () const noexcept |
reverse_iterator | rbegin () noexcept |
const_reverse_iterator | rbegin () const noexcept |
const_reverse_iterator | crbegin () const noexcept |
reverse_iterator | rend () noexcept |
const_reverse_iterator | rend () const noexcept |
const_reverse_iterator | crend () const noexcept |
bool | empty () const noexcept |
bool | full () const noexcept |
size_type | size () const noexcept |
constexpr size_type | capacity () const noexcept |
void | clear () noexcept |
iterator | insert (const const_iterator location, const T &value) |
Inserts an element at location. More... | |
iterator | insert (const const_iterator location, T &&value) |
Same as above but the new element is move-constructed. More... | |
void | push_back (const T &value) |
If an exception is thrown this function has no effect (strong exception guarantee). More... | |
void | push_back (T &&value) |
If an exception is thrown this function has no effect (strong exception guarantee). More... | |
template<typename... Args> | |
reference | emplace_back (Args &&... args) |
If an exception is thrown this function has no effect (strong exception guarantee). More... | |
void | pop_back () noexcept |
void | resize (const size_type newSize) |
Constructs or destructs elements to adjust to newSize. More... | |
void | resize (const size_type newSize, const T &value) |
Same as above but uses value to copy-construct the new elements. More... | |
Private Types | |
using | EagerInitialized = std::array< T, N > |
Private Member Functions | |
iterator | MakeMutableIterator (const const_iterator iter) noexcept |
Private Attributes | |
std::array< std::byte, sizeof(T) *N > | m_Data |
size_type | m_Size {0} |
Friends | |
template<size_t OtherN> | |
bool | operator== (const StaticVector< T, N > &lhs, const StaticVector< T, OtherN > &rhs) |
template<size_t OtherN> | |
bool | operator!= (const StaticVector< T, N > &lhs, const StaticVector< T, OtherN > &rhs) |
A conntainer close to std::vector but the elements are stored in place: There is a fixed capacity and there is no dynamic memory allocation.
Note: moving a StaticVector will be slower than moving a std::vector in case of sizeof(StaticVector) > sizeof(std::vector).
using PS::StaticVector< T, N >::const_iterator = const_pointer |
using PS::StaticVector< T, N >::const_pointer = const value_type* |
using PS::StaticVector< T, N >::const_reference = const value_type& |
using PS::StaticVector< T, N >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
using PS::StaticVector< T, N >::difference_type = decltype(MakeSmallestCapableSigned<N>()) |
|
private |
using PS::StaticVector< T, N >::iterator = pointer |
using PS::StaticVector< T, N >::pointer = value_type* |
using PS::StaticVector< T, N >::reference = value_type& |
using PS::StaticVector< T, N >::reverse_iterator = std::reverse_iterator<iterator> |
using PS::StaticVector< T, N >::size_type = decltype(MakeSmallestCapableUnsigned<N>()) |
using PS::StaticVector< T, N >::value_type = T |
|
default |
|
inlinenoexcept |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inlineexplicitnoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
If an exception is thrown this function has no effect (strong exception guarantee).
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Inserts an element at location.
The elements which were in the range [ location, end() ) get moved no the next position.
Exceptions: If an exception is thrown when inserting an element at the end this function has no effect (strong exception guarantee). Otherwise the program is in a valid state (Basic exception guarantee).
|
inline |
Same as above but the new element is move-constructed.
If an exception is thrown when inserting an element at the end this function has no effect (strong exception guarantee). If an exception is thrown the program is in a valid state (Basic exception guarantee).
|
inlineprivatenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
If an exception is thrown this function has no effect (strong exception guarantee).
|
inline |
If an exception is thrown this function has no effect (strong exception guarantee).
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Constructs or destructs elements to adjust to newSize.
After this call the StaticVector contains newSize elements. Unlike std::vector the capacity does not get changed. If newSize is bigger then the capacity a CapacityExceededException is thrown.
If newSize is smaller than size() (shrinking) no exception is thrown (Nothrow exception guarantee). If an exception is thrown this function has no effect. (strong exception guarantee)
|
inline |
Same as above but uses value to copy-construct the new elements.
If newSize is smaller than size() (shrinking) no exception is thrown (Nothrow exception guarantee). If an exception is thrown this function has no effect. (strong exception guarantee)
|
inlinenoexcept |
|
friend |
|
friend |
|
private |
|
private |