|
LibSWOC++ 1.5.14
Solid Wall of C++
|
#include <Vectray.h>

Classes | |
| struct | FixedStore |
| Internal (fixed) storage. More... | |
Public Types | |
| using | value_type = T |
| Element type for container. | |
| using | reference = std::remove_reference<T> & |
| Reference to element. | |
| using | const_reference = std::remove_reference<T> const & |
| Reference to constant element. | |
| using | pointer = std::remove_reference<T> * |
| Pointer to element. | |
| using | const_pointer = std::remove_reference<T> const * |
| Pointer to constant element. | |
| using | allocator_type = A |
| Dynamic storage allocator. | |
| using | size_type = typename vector_type::size_type |
| Type for element count. | |
| using | difference_type = typename vector_type::difference_type |
| Iterator difference. | |
| using | iterator = typename swoc::MemSpan<T>::iterator |
| Element iteration. | |
| using | const_iterator = typename swoc::MemSpan<const T>::iterator |
| Constant element iteration. | |
| using | DynamicStore = vector_type |
| Dynamic (heap) storage. | |
| using | span = swoc::MemSpan<T> |
| Element access. | |
| using | const_span = swoc::MemSpan<T const> |
| Constant element access. | |
Public Member Functions | |
| Vectray () | |
| Default constructor, construct an empty container. | |
| ~Vectray ()=default | |
| constexpr | Vectray (allocator_type const &a) |
| Construct empty instance with allocator. | |
| Vectray (size_type n, allocator_type const &alloc=allocator_type{}) | |
| template<size_t M> | |
| Vectray (Vectray< T, M, A > &&that) | |
| Move constructor for difference static sized instance. | |
| Vectray (self_type &&that, allocator_type const &a) | |
| Move constructor. | |
| size_type | size () const |
| T * | data () |
| T const * | data () const |
| bool | empty () const |
| operator span () | |
Implicitly convert to a MemSpan. | |
| operator const_span () const | |
Implicitly convert to a MemSpan. | |
| T & | operator[] (size_type idx) |
| T const & | operator[] (size_type idx) const |
| T const & | front () const |
| T & | front () |
| T const & | back () const |
| T & | back () |
| self_type & | push_back (T const &t) |
| self_type & | push_back (T &&t) |
| template<typename... Args> | |
| self_type & | emplace_back (Args &&...args) |
| self_type & | pop_back () |
| const_iterator | begin () const |
| Iterator for first element. | |
| const_iterator | end () const |
| Iterator past last element. | |
| iterator | begin () |
| Iterator for last element. | |
| iterator | end () |
| Iterator past last element. | |
| void | reserve (size_type n) |
| Force at internal storage to hold at least n items. | |
Protected Member Functions | |
| span | items () |
| Get the span of the valid items. | |
| const_span | items () const |
| Get the span of the valid items. | |
| void | transfer (size_type rN=BASE_DYNAMIC_SIZE) |
Protected Attributes | |
| std::variant< FixedStore, DynamicStore > | _store |
Static Protected Attributes | |
| static constexpr auto | FIXED = 0 |
| Variant index for fixed storage. | |
| static constexpr auto | DYNAMIC = 1 |
| Variant index for dynamic storage. | |
| static constexpr size_type | BASE_DYNAMIC_SIZE = (7 * N) / 5 |
| Default size to reserve in the vector when switching to dynamic. | |
Vectray provides a combination of static and dynamic storage modeled as an array.
| T | Type of elements in the array. |
| N | Number of statically allocated elements. |
| A | Allocator. |
The goal is to provide static storage for the common case, avoiding memory allocation, while still handling exceptional cases that need more storage. A common case is for N == 1 where there is almost always a single value, but it is possible to have multiple values. Vectray makes the single value case require no allocation while transparently handling the multiple value case.
The interface is designed to mimic that of std::vector.
| using swoc::Vectray< T, N, A >::allocator_type = A |
| using swoc::Vectray< T, N, A >::const_iterator = typename swoc::MemSpan<const T>::iterator |
| using swoc::Vectray< T, N, A >::const_pointer = std::remove_reference<T> const * |
| using swoc::Vectray< T, N, A >::const_reference = std::remove_reference<T> const & |
| using swoc::Vectray< T, N, A >::const_span = swoc::MemSpan<T const> |
| using swoc::Vectray< T, N, A >::difference_type = typename vector_type::difference_type |
| using swoc::Vectray< T, N, A >::DynamicStore = vector_type |
| using swoc::Vectray< T, N, A >::iterator = typename swoc::MemSpan<T>::iterator |
| using swoc::Vectray< T, N, A >::pointer = std::remove_reference<T> * |
| using swoc::Vectray< T, N, A >::reference = std::remove_reference<T> & |
| using swoc::Vectray< T, N, A >::size_type = typename vector_type::size_type |
| using swoc::Vectray< T, N, A >::span = swoc::MemSpan<T> |
| using swoc::Vectray< T, N, A >::value_type = T |
| swoc::Vectray< T, N, A >::Vectray | ( | ) |
|
default |
Destructor - destructs all contained elements.
|
inlineexplicitconstexpr |
|
explicit |
| swoc::Vectray< T, N, A >::Vectray | ( | Vectray< T, M, A > && | that | ) |
|
inline |
|
inline |
| auto swoc::Vectray< T, N, A >::begin | ( | ) |
| auto swoc::Vectray< T, N, A >::begin | ( | ) | const |
| T * swoc::Vectray< T, N, A >::data | ( | ) |
| T const * swoc::Vectray< T, N, A >::data | ( | ) | const |
| Vectray< T, N, A >::self_type & swoc::Vectray< T, N, A >::emplace_back | ( | Args &&... | args | ) |
| bool swoc::Vectray< T, N, A >::empty | ( | ) | const |
| auto swoc::Vectray< T, N, A >::end | ( | ) |
| auto swoc::Vectray< T, N, A >::end | ( | ) | const |
|
inline |
|
inline |
|
protected |
|
protected |
|
inline |
|
inline |
| T & swoc::Vectray< T, N, A >::operator[] | ( | size_type | idx | ) |
| T const & swoc::Vectray< T, N, A >::operator[] | ( | size_type | idx | ) | const |
| auto swoc::Vectray< T, N, A >::pop_back | ( | ) |
| auto swoc::Vectray< T, N, A >::push_back | ( | T && | t | ) |
| auto swoc::Vectray< T, N, A >::push_back | ( | T const & | t | ) |
| void swoc::Vectray< T, N, A >::reserve | ( | Vectray< T, N, A >::size_type | n | ) |
| auto swoc::Vectray< T, N, A >::size | ( | ) | const |
|
protected |
|
protected |
|
staticconstexprprotected |
|
staticconstexprprotected |
|
staticconstexprprotected |