Molassembler  1.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::Temple::DynamicArray< T, nItems > Class Template Reference
Inheritance diagram for Scine::Molassembler::Temple::DynamicArray< T, nItems >:

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 Member Functions

Private member functions
template<std::size_t... Inds>
std::array< T, nItems > makeArray (std::index_sequence< Inds...>)
 
constexpr void moveElementsRightUntil_ (const iterator &position)
 

Private Attributes

State
items_ [nItems]
 
std::size_t count_ = 0
 

Constructor & Destructor Documentation

template<typename T, std::size_t nItems>
template<std::size_t... Inds>
constexpr Scine::Molassembler::Temple::DynamicArray< T, nItems >::DynamicArray ( const DynamicArray< T, nItems > &  other,
std::index_sequence< Inds...>   
)
inline

Helper to the copy constructor.

Delegate copy constructor directly forms the array mem-initializer with a parameter pack expansion

template<typename T, std::size_t nItems>
constexpr Scine::Molassembler::Temple::DynamicArray< T, nItems >::DynamicArray ( const DynamicArray< T, nItems > &  other)
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)\)

template<typename T, std::size_t nItems>
constexpr Scine::Molassembler::Temple::DynamicArray< T, nItems >::DynamicArray ( DynamicArray< T, nItems > &&  other)
inlinenoexcept

Move constructor.

Constructed using the same technique as the copy constructor using a delegate.

Complexity \(\Theta(N)\)


The documentation for this class was generated from the following file: