std::dynarray

From cppreference.com
< cpp‎ | container
Defined in header <dynarray>
template<

    class T

> class dynarray;
(since C++14)

std::dynarray is a sequence container that encapsulates arrays with a size that is fixed at construction and does not change throughout the lifetime of the object.

The elements are stored contiguously, which means that elements can be accessed not only through iterators, but also using offsets on regular pointers to elements. This means that a pointer to an element of a dynarray may be passed to any function that expects a pointer to an element of an array.

There is a special case for a zero-length array (the number of elements was specified as zero during construction). In that case, array.begin() == array.end(), which is some unique value. The effect of calling front() or back() on a zero-sized dynarray is undefined.


Contents

[edit] Template parameters

[edit] Member types

Member type Definition
value_type T
size_type std::size_t
difference_type std::ptrdiff_t
reference value_type&
const_reference const value_type&
pointer value_type*
const_pointer const value_type*
iterator RandomAccessIterator
const_iterator Constant random access iterator
reverse_iterator std::reverse_iterator<iterator>
const_reverse_iterator std::reverse_iterator<const_iterator>

[edit] Member functions

constructs the dynarray
(public member function)
destructs the dynarray
(public member function)
operator=
[deleted]
the container is neither copy-, nor move-assignable
(public member function)
Element access
access specified element with bounds checking
(public member function)
access specified element
(public member function)
access the first element
(public member function)
access the last element
(public member function)
direct access to the underlying array
(public member function)
Iterators
returns an iterator to the beginning
(public member function)
returns an iterator to the end
(public member function)
returns a reverse iterator to the beginning
(public member function)
returns a reverse iterator to the end
(public member function)
Capacity
checks whether the container is empty
(public member function)
returns the number of elements
(public member function)
returns the maximum possible number of elements
(public member function)
Modifiers
fill the container with specified value
(public member function)

[edit] Non-member functions

lexicographically compares the values in the dynarray
(function template)

[edit] Helper classes

specializes the std::uses_allocator type trait
(function template)