Data Structures | |
class | const_iterator |
Nonmodifiable data iterator. More... | |
Public Member Functions | |
PURITY_WEAK constexpr iterator | begin () noexcept |
PURITY_WEAK constexpr iterator | end () noexcept |
PURITY_WEAK constexpr const_iterator | begin () const noexcept |
PURITY_WEAK constexpr const_iterator | end () const noexcept |
Constructors | |
constexpr | DynamicArray () |
Default constructor. | |
template<std::size_t... Inds> | |
constexpr | DynamicArray (const DynamicArray &other, std::index_sequence< Inds...>) |
Helper to the copy constructor. More... | |
constexpr | DynamicArray (const DynamicArray &other) |
Copy constructor. More... | |
count_ (other.count_) | |
Default constructor. | |
constexpr | DynamicArray (DynamicArray &&other) noexcept |
Move constructor. More... | |
Converting constructors | |
template<template< typename, std::size_t > class ArrayType, std::size_t N, std::size_t... Inds> | |
constexpr | DynamicArray (const ArrayType< T, N > &other, std::index_sequence< Inds...>) |
Construct from any-size array-like container using same trick as copy ctor. | |
template<template< typename, std::size_t > class ArrayType, std::size_t N> | |
constexpr | DynamicArray (const ArrayType< T, N > &other, std::enable_if_t<(N<=nItems)> *=0) |
Construct from any size of other array-like classes. | |
Converting operators | |
PURITY_WEAK constexpr | operator std::array< T, nItems > () const noexcept |
Convert the dynamic array to an array. | |
Private Attributes | |
State | |
T | items_ [nItems] |
std::size_t | count_ = 0 |
|
inline |
Helper to the copy constructor.
Delegate copy constructor directly forms the array mem-initializer with a parameter pack expansion
|
inline |
Copy constructor.
Constructing from another dynamic array is tricky since we're technically not allowed to edit items_ in-class, so we delegate to the previous constructor and directly form the mem-initializer
Complexity \(\Theta(N)\)
|
inlinenoexcept |
Move constructor.
Constructed using the same technique as the copy constructor using a delegate.
Complexity \(\Theta(N)\)