Dynamic Array¶
-
template <typename T> dynamic_array
Container that dynamically allocates memory so that the elements are permanently stored in contiguous memory. Elements are written and accessed using the
operator[]
or a pointer to the first element withdata()
.-
Container = std::vector<T>
-
value_type = T
-
reference = value_type&
-
const_reference = value_type const&
-
size_type = typename Container::size_type
-
reference
operator[]
(size_type index)¶ Parameters: index – Index of the element to be retrieved. Returns: The index
-th element of the array. If that index has not beenfilled yet, a default-inserted element is returned.
-
const_reference
operator[]
(size_type index) const¶ Parameters: index – Index of the element to be retrieved. Returns: The index
-th element of the array. If that index has not beenfilled yet, an
std::out_of_range
exception is thrown.
-
size_type
size
() const¶ Returns: The number of elements currently held by the array.
-
T *
data
()¶ Returns: A pointer to the first element of the array.
-
T const *
data
() const¶ Returns: A pointer to the first element of the array.
-