template<typename T, std::size_t TSize>
class comms::util::StaticVector< T, TSize >
Replacement to std::vector when no dynamic memory allocation is allowed.
Uses std::array in its private members to store the data. Provides almost the same interface as std::vector.
- Template Parameters
-
| T | Type of the stored elements. |
| TSize | Maximum number of elements that StaticVector can store. |
Inherits details::ChooseStaticVectorBase< T, TSize >.
|
|
using | const_iterator = typename Base::const_iterator |
| | Type of the const iterator.
|
| |
|
using | const_pointer = typename Base::const_pointer |
| | Const pointer to single element.
|
| |
|
using | const_reference = typename Base::const_reference |
| | Const reference to single element.
|
| |
|
using | const_reverse_iterator = typename Base::const_reverse_iterator |
| | Type of the const reverse iterator.
|
| |
|
using | difference_type = typename Base::StorageType::difference_type |
| | Type used in pointer arithmetics.
|
| |
|
using | iterator = typename Base::iterator |
| | Type of the iterator.
|
| |
|
using | pointer = typename Base::pointer |
| | Pointer to single element.
|
| |
|
using | reference = typename Base::reference |
| | Reference to single element.
|
| |
|
using | reverse_iterator = typename Base::reverse_iterator |
| | Type of the reverse iterator.
|
| |
|
using | size_type = typename Base::size_type |
| | Type used for size information.
|
| |
|
using | value_type = typename Base::value_type |
| | Type of single element.
|
| |
|
|
| StaticVector ()=default |
| | Default constructor.
|
| |
| | StaticVector (const StaticVector &other) |
| | Copy constructor.
|
| |
| template<std::size_t TOtherSize> |
| | StaticVector (const StaticVector< T, TOtherSize > &other) |
| | Copy constructor.
|
| |
| | StaticVector (size_type count) |
| | Constructor.
|
| |
| | StaticVector (size_type count, const T &value) |
| | Constructor.
|
| |
| | StaticVector (std::initializer_list< value_type > init) |
| | Constructor.
|
| |
| template<typename TIter > |
| | StaticVector (TIter from, TIter to) |
| | Constructor.
|
| |
|
| ~StaticVector () noexcept=default |
| | Destructor.
|
| |
| void | assign (size_type count, const T &value) |
| | Assigns values to the container.
|
| |
| void | assign (std::initializer_list< value_type > init) |
| | Assigns values to the container.
|
| |
| template<typename TIter > |
| void | assign (TIter from, TIter to) |
| | Assigns values to the container.
|
| |
| reference | at (size_type pos) |
| | Access specified element with bounds checking.
|
| |
| const_reference | at (size_type pos) const |
| | Access specified element with bounds checking.
|
| |
| reference | back () |
| | Access the last element.
|
| |
| const_reference | back () const |
| | Access the last element.
|
| |
| iterator | begin () |
| | Returns an iterator to the beginning.
|
| |
| const_iterator | begin () const |
| | Returns an iterator to the beginning.
|
| |
| size_type | capacity () const |
| | Returns the number of elements that can be held in currently allocated storage.
|
| |
| const_iterator | cbegin () const |
| | Returns an iterator to the beginning.
|
| |
| const_iterator | cend () const |
| | Returns an iterator to the end.
|
| |
| void | clear () |
| | Clears the contents.
|
| |
| const_reverse_iterator | crbegin () const |
| | Returns a reverse iterator to the beginning.
|
| |
| const_reverse_iterator | crend () const |
| | Returns a reverse iterator to the end.
|
| |
| pointer | data () |
| | Direct access to the underlying array.
|
| |
| const_pointer | data () const |
| | Direct access to the underlying array.
|
| |
| template<typename... TArgs> |
| iterator | emplace (const_iterator iter, TArgs &&... args) |
| | Constructs elements in place.
|
| |
| template<typename... TArgs> |
| void | emplace_back (TArgs &&... args) |
| | Constructs an element in place at the end.
|
| |
| bool | empty () const |
| | Checks whether the container is empty.
|
| |
| iterator | end () |
| | Returns an iterator to the end.
|
| |
| const_iterator | end () const |
| | Returns an iterator to the end.
|
| |
| iterator | erase (const_iterator from, const_iterator to) |
| | Erases elements.
|
| |
| iterator | erase (const_iterator iter) |
| | Erases elements.
|
| |
| reference | front () |
| | Access the first element.
|
| |
| const_reference | front () const |
| | Access the first element.
|
| |
| iterator | insert (const_iterator iter, const T &value) |
| | Inserts elements.
|
| |
| iterator | insert (const_iterator iter, size_type count, const T &value) |
| | Inserts elements.
|
| |
| iterator | insert (const_iterator iter, std::initializer_list< value_type > init) |
| | Inserts elements.
|
| |
| iterator | insert (const_iterator iter, T &&value) |
| | Inserts elements.
|
| |
| template<typename TIter > |
| iterator | insert (const_iterator iter, TIter from, TIter to) |
| | Inserts elements.
|
| |
| size_type | max_size () const |
| | Returns the maximum possible number of elements.
|
| |
| StaticVector & | operator= (const StaticVector &)=default |
| | Copy assignement.
|
| |
| template<std::size_t TOtherSize> |
| StaticVector & | operator= (const StaticVector< T, TOtherSize > &other) |
| | Copy assignement.
|
| |
| StaticVector & | operator= (std::initializer_list< value_type > init) |
| | Copy assignement.
|
| |
| reference | operator[] (size_type pos) |
| | Access specified element without bounds checking.
|
| |
| const_reference | operator[] (size_type pos) const |
| | Access specified element without bounds checking.
|
| |
| void | pop_back () |
| | Removes the last element.
|
| |
| void | push_back (const T &value) |
| | Adds an element to the end.
|
| |
| void | push_back (T &&value) |
| | Adds an element to the end.
|
| |
| reverse_iterator | rbegin () |
| | Returns a reverse iterator to the beginning.
|
| |
| const_reverse_iterator | rbegin () const |
| | Returns a reverse iterator to the beginning.
|
| |
| reverse_iterator | rend () |
| | Returns a reverse iterator to the end.
|
| |
| const_reverse_iterator | rend () const |
| | Returns a reverse iterator to the end.
|
| |
| void | reserve (size_type new_cap) |
| | Reserves storage.
|
| |
| void | resize (size_type count) |
| | Changes the number of elements stored.
|
| |
| void | resize (size_type count, const value_type &value) |
| | Changes the number of elements stored.
|
| |
| void | shrink_to_fit () |
| | Reduces memory usage by freeing unused memory.
|
| |
| size_type | size () const |
| | Returns the number of elements.
|
| |
| template<std::size_t TOtherSize> |
| void | swap (StaticVector< T, TOtherSize > &other) |
| | Swaps the contents.
|
| |
|
(Note that these are not member symbols.)
|
|
template<typename T > |
| static constexpr bool | isStaticVector () |
| | Compile time check whether the provided type is a variant of comms::util::StaticVector.
|
| |
| template<typename T , std::size_t TSize1, std::size_t TSize2> |
| bool | operator!= (const StaticVector< T, TSize1 > &v1, const StaticVector< T, TSize2 > &v2) |
| | Lexicographically compares the values in the vector.
|
| |
| template<typename T , std::size_t TSize1, std::size_t TSize2> |
| bool | operator< (const StaticVector< T, TSize1 > &v1, const StaticVector< T, TSize2 > &v2) |
| | Lexicographically compares the values in the vector.
|
| |
| template<typename T , std::size_t TSize1, std::size_t TSize2> |
| bool | operator<= (const StaticVector< T, TSize1 > &v1, const StaticVector< T, TSize2 > &v2) |
| | Lexicographically compares the values in the vector.
|
| |
| template<typename T , std::size_t TSize1, std::size_t TSize2> |
| bool | operator== (const StaticVector< T, TSize1 > &v1, const StaticVector< T, TSize2 > &v2) |
| | Lexicographically compares the values in the vector.
|
| |
| template<typename T , std::size_t TSize1, std::size_t TSize2> |
| bool | operator> (const StaticVector< T, TSize1 > &v1, const StaticVector< T, TSize2 > &v2) |
| | Lexicographically compares the values in the vector.
|
| |
| template<typename T , std::size_t TSize1, std::size_t TSize2> |
| bool | operator>= (const StaticVector< T, TSize1 > &v1, const StaticVector< T, TSize2 > &v2) |
| | Lexicographically compares the values in the vector.
|
| |
| template<typename T , std::size_t TSize1, std::size_t TSize2> |
| void | swap (comms::util::StaticVector< T, TSize1 > &v1, comms::util::StaticVector< T, TSize2 > &v2) |
| | Specializes the std::swap algorithm.
|
| |