dune-common 2.9.0
|
A Vector class with statically reserved memory. More...
#include <dune/common/reservedvector.hh>
Public Types | |
typedef storage_type::value_type | value_type |
The type of object, T, stored in the vector. | |
typedef storage_type::pointer | pointer |
Pointer to T. | |
typedef storage_type::const_pointer | const_pointer |
Const pointer to T. | |
typedef storage_type::reference | reference |
Reference to T. | |
typedef storage_type::const_reference | const_reference |
Const reference to T. | |
typedef storage_type::size_type | size_type |
An unsigned integral type. | |
typedef storage_type::difference_type | difference_type |
A signed integral type. | |
typedef storage_type::iterator | iterator |
Iterator used to iterate through a vector. | |
typedef storage_type::const_iterator | const_iterator |
Const iterator used to iterate through a vector. | |
typedef std::reverse_iterator< iterator > | reverse_iterator |
Reverse iterator. | |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
Const reverse iterator. | |
Public Member Functions | |
constexpr | ReservedVector (size_type count) noexcept(std::is_nothrow_default_constructible_v< value_type >) |
Constructs the vector with count elements that will be default-initialized. | |
constexpr | ReservedVector (size_type count, const value_type &value) noexcept(std::is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector(count))) |
Constructs the vector with count copies of elements with value value . | |
template<class InputIt , std::enable_if_t< std::is_convertible_v< typename std::iterator_traits< InputIt >::value_type, value_type >, int > = 0> | |
constexpr | ReservedVector (InputIt first, InputIt last) noexcept(std::is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector())) |
Constructs the vector from an iterator range [first,last) | |
constexpr | ReservedVector (std::initializer_list< value_type > const &l) noexcept(std::is_nothrow_copy_assignable_v< value_type > &&noexcept(ReservedVector(l.begin(), l.end()))) |
Constructs the vector from an initializer list. | |
constexpr bool | operator== (const ReservedVector &that) const noexcept |
Compares the values in the vector this with that for equality. | |
constexpr bool | operator!= (const ReservedVector &that) const noexcept |
Compares the values in the vector this with that for not equality. | |
constexpr bool | operator< (const ReservedVector &that) const noexcept |
Lexicographically compares the values in the vector this with that | |
constexpr bool | operator> (const ReservedVector &that) const noexcept |
Lexicographically compares the values in the vector this with that | |
constexpr bool | operator<= (const ReservedVector &that) const noexcept |
Lexicographically compares the values in the vector this with that | |
constexpr bool | operator>= (const ReservedVector &that) const noexcept |
Lexicographically compares the values in the vector this with that | |
constexpr void | clear () noexcept |
Erases all elements. | |
constexpr void | resize (size_type s) noexcept |
Specifies a new size for the vector. | |
constexpr void | push_back (const value_type &t) noexcept(std::is_nothrow_copy_assignable_v< value_type >) |
Appends an element to the end of a vector, up to the maximum size n, O(1) time. | |
constexpr void | push_back (value_type &&t) noexcept(std::is_nothrow_move_assignable_v< value_type >) |
Appends an element to the end of a vector by moving the value, up to the maximum size n, O(1) time. | |
template<class... Args> | |
reference | emplace_back (Args &&... args) noexcept(std::is_nothrow_constructible_v< value_type, decltype(args)... >) |
Appends an element to the end of a vector by constructing it in place. | |
constexpr void | pop_back () noexcept |
Erases the last element of the vector, O(1) time. | |
constexpr iterator | begin () noexcept |
Returns a iterator pointing to the beginning of the vector. | |
constexpr const_iterator | begin () const noexcept |
Returns a const_iterator pointing to the beginning of the vector. | |
constexpr const_iterator | cbegin () const noexcept |
Returns a const_iterator pointing to the beginning of the vector. | |
constexpr reverse_iterator | rbegin () noexcept |
Returns a const reverse-iterator pointing to the end of the vector. | |
constexpr const_reverse_iterator | rbegin () const noexcept |
Returns a const reverse-iterator pointing to the end of the vector. | |
constexpr const_reverse_iterator | crbegin () const noexcept |
Returns a const reverse-iterator pointing to the end of the vector. | |
constexpr iterator | end () noexcept |
Returns an iterator pointing to the end of the vector. | |
constexpr const_iterator | end () const noexcept |
Returns a const_iterator pointing to the end of the vector. | |
constexpr const_iterator | cend () const noexcept |
Returns a const_iterator pointing to the end of the vector. | |
constexpr reverse_iterator | rend () noexcept |
Returns a const reverse-iterator pointing to the begin of the vector. | |
constexpr const_reverse_iterator | rend () const noexcept |
Returns a const reverse-iterator pointing to the begin of the vector. | |
constexpr const_reverse_iterator | crend () const noexcept |
Returns a const reverse-iterator pointing to the begin of the vector. | |
constexpr reference | at (size_type i) |
Returns reference to the i'th element. | |
constexpr const_reference | at (size_type i) const |
Returns a const reference to the i'th element. | |
constexpr reference | operator[] (size_type i) noexcept |
Returns reference to the i'th element. | |
constexpr const_reference | operator[] (size_type i) const noexcept |
Returns a const reference to the i'th element. | |
constexpr reference | front () noexcept |
Returns reference to first element of vector. | |
constexpr const_reference | front () const noexcept |
Returns const reference to first element of vector. | |
constexpr reference | back () noexcept |
Returns reference to last element of vector. | |
constexpr const_reference | back () const noexcept |
Returns const reference to last element of vector. | |
constexpr pointer | data () noexcept |
Returns pointer to the underlying memory. | |
constexpr const_pointer | data () const noexcept |
Returns const pointer to the underlying memory. | |
constexpr void | fill (const value_type &value) noexcept(std::is_nothrow_copy_assignable_v< value_type >) |
Fill the container with the value. | |
void | swap (ReservedVector &other) noexcept(std::is_nothrow_swappable_v< value_type >) |
Swap the content with another vector. | |
constexpr size_type | size () const noexcept |
Returns number of elements in the vector. | |
constexpr bool | empty () const noexcept |
Returns true if vector has no elements. | |
static constexpr size_type | capacity () noexcept |
Returns current capacity (allocated memory) of the vector. | |
static constexpr size_type | max_size () noexcept |
Returns the maximum length of the vector. | |
A Vector class with statically reserved memory.
ReservedVector is something between std::array and std::vector. It is a dynamically sized vector which can be extended and shrunk using methods like push_back and pop_back, but reserved memory is statically predefined.
This implies that the vector cannot grow bigger than the predefined maximum size.
T | The value type ReservedVector stores. |
n | The maximum number of objects the ReservedVector can store. |
typedef storage_type::const_iterator Dune::ReservedVector< T, n >::const_iterator |
Const iterator used to iterate through a vector.
typedef storage_type::const_pointer Dune::ReservedVector< T, n >::const_pointer |
Const pointer to T.
typedef storage_type::const_reference Dune::ReservedVector< T, n >::const_reference |
Const reference to T.
typedef std::reverse_iterator<const_iterator> Dune::ReservedVector< T, n >::const_reverse_iterator |
Const reverse iterator.
typedef storage_type::difference_type Dune::ReservedVector< T, n >::difference_type |
A signed integral type.
typedef storage_type::iterator Dune::ReservedVector< T, n >::iterator |
Iterator used to iterate through a vector.
typedef storage_type::pointer Dune::ReservedVector< T, n >::pointer |
Pointer to T.
typedef storage_type::reference Dune::ReservedVector< T, n >::reference |
Reference to T.
typedef std::reverse_iterator<iterator> Dune::ReservedVector< T, n >::reverse_iterator |
Reverse iterator.
typedef storage_type::size_type Dune::ReservedVector< T, n >::size_type |
An unsigned integral type.
typedef storage_type::value_type Dune::ReservedVector< T, n >::value_type |
The type of object, T, stored in the vector.
Typedefs
|
inlineconstexprnoexcept |
Constructs an empty vector.
Constructors
|
inlineexplicitconstexprnoexcept |
Constructs the vector with count
elements that will be default-initialized.
|
inlineconstexprnoexcept |
Constructs the vector with count
copies of elements with value value
.
|
inlineconstexprnoexcept |
Constructs the vector from an iterator range [first,last)
|
inlineconstexprnoexcept |
Constructs the vector from an initializer list.
|
inlineconstexpr |
Returns reference to the i'th element.
Element access
|
inlineconstexpr |
Returns a const reference to the i'th element.
|
inlineconstexprnoexcept |
Returns const reference to last element of vector.
|
inlineconstexprnoexcept |
Returns reference to last element of vector.
|
inlineconstexprnoexcept |
Returns a const_iterator pointing to the beginning of the vector.
|
inlineconstexprnoexcept |
Returns a iterator pointing to the beginning of the vector.
Iterators
|
inlinestaticconstexprnoexcept |
Returns current capacity (allocated memory) of the vector.
|
inlineconstexprnoexcept |
Returns a const_iterator pointing to the beginning of the vector.
|
inlineconstexprnoexcept |
Returns a const_iterator pointing to the end of the vector.
|
inlineconstexprnoexcept |
Erases all elements.
Modifiers
|
inlineconstexprnoexcept |
Returns a const reverse-iterator pointing to the end of the vector.
|
inlineconstexprnoexcept |
Returns a const reverse-iterator pointing to the begin of the vector.
|
inlineconstexprnoexcept |
Returns const pointer to the underlying memory.
|
inlineconstexprnoexcept |
Returns pointer to the underlying memory.
|
inlinenoexcept |
Appends an element to the end of a vector by constructing it in place.
|
inlineconstexprnoexcept |
Returns true if vector has no elements.
|
inlineconstexprnoexcept |
Returns a const_iterator pointing to the end of the vector.
|
inlineconstexprnoexcept |
Returns an iterator pointing to the end of the vector.
|
inlineconstexprnoexcept |
Fill the container with the value.
Operations
|
inlineconstexprnoexcept |
Returns const reference to first element of vector.
|
inlineconstexprnoexcept |
Returns reference to first element of vector.
|
inlinestaticconstexprnoexcept |
Returns the maximum length of the vector.
|
inlineconstexprnoexcept |
Compares the values in the vector this
with that
for not equality.
|
inlineconstexprnoexcept |
Lexicographically compares the values in the vector this
with that
|
inlineconstexprnoexcept |
Lexicographically compares the values in the vector this
with that
|
inlineconstexprnoexcept |
Compares the values in the vector this
with that
for equality.
Comparison
|
inlineconstexprnoexcept |
Lexicographically compares the values in the vector this
with that
|
inlineconstexprnoexcept |
Lexicographically compares the values in the vector this
with that
|
inlineconstexprnoexcept |
Returns a const reference to the i'th element.
|
inlineconstexprnoexcept |
Returns reference to the i'th element.
|
inlineconstexprnoexcept |
Erases the last element of the vector, O(1) time.
|
inlineconstexprnoexcept |
Appends an element to the end of a vector, up to the maximum size n, O(1) time.
|
inlineconstexprnoexcept |
Appends an element to the end of a vector by moving the value, up to the maximum size n, O(1) time.
|
inlineconstexprnoexcept |
Returns a const reverse-iterator pointing to the end of the vector.
|
inlineconstexprnoexcept |
Returns a const reverse-iterator pointing to the end of the vector.
|
inlineconstexprnoexcept |
Returns a const reverse-iterator pointing to the begin of the vector.
|
inlineconstexprnoexcept |
Returns a const reverse-iterator pointing to the begin of the vector.
|
inlineconstexprnoexcept |
Specifies a new size for the vector.
|
inlineconstexprnoexcept |
Returns number of elements in the vector.
Capacity
|
inlinenoexcept |
Swap the content with another vector.