|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Special constructors common to Aleph-w ( \(\aleph_\omega\)) containers.
More...
#include <ah-dry.H>
Public Member Functions | |
| SpecialCtors ()=default | |
| Default constructor; it appends nothing. | |
| SpecialCtors (const SpecialCtors &)=default | |
| Copy constructor; the derived container copies its items. | |
| SpecialCtors (SpecialCtors &&) noexcept | |
| Move constructor; the derived container moves its items. | |
| SpecialCtors & | operator= (const SpecialCtors &)=default |
| Copy assignment; the derived container copies its items. | |
| SpecialCtors & | operator= (SpecialCtors &&) noexcept |
| Move assignment; the derived container moves its items. | |
| SpecialCtors (const Aleph::DynList< T > &l) | |
Build the container by inserting all items of the list l. | |
| template<class It > requires (not std::is_arithmetic_v<It> and requires(It it) { *it; ++it; it != it; }) | |
| SpecialCtors (It b, It e) | |
| Construct the container from a range of iterators. | |
| SpecialCtors (std::initializer_list< T > l) | |
| Construct the container from an initializer list. | |
Private Member Functions | |
| void | free_appended () noexcept |
| Free the items that a constructor of this base appended. | |
| template<class Fill > | |
| void | build_apart (Fill fill) |
Fill the container: in another one built apart, whose items it takes with swap(), if the container has a default constructor and swap(); if not, in place, freeing with free_appended() what was appended if fill throws. | |
Special constructors common to Aleph-w ( \(\aleph_\omega\)) containers.
Basically, the constructors of this class append a sequence of items.
|
default |
Default constructor; it appends nothing.
|
default |
Copy constructor; the derived container copies its items.
|
inlinenoexcept |
|
inline |
Build the container by inserting all items of the list l.
| [in] | l | list of items to insert |
| bad_alloc | if there is no enough memory, or what the copy of an item throws. Then the items already appended are freed, if the container has empty(): its destructor does not run. |
Definition at line 1128 of file ah-dry.H.
References SpecialCtors< Container, T >::build_apart(), FunctionalMethods< Container, T >::for_each(), and l.
|
inline |
Construct the container from a range of iterators.
It must behave as an iterator: an arithmetic type, as in DynList<int> l(3, 7), does not select this constructor.
| [in] | b | begin iterator |
| [in] | e | end iterator |
| bad_alloc | if there is no enough memory, or what the iterators or the copy of an item throw. Then the items already appended are freed, if the container has empty(). |
Definition at line 1150 of file ah-dry.H.
References SpecialCtors< Container, T >::build_apart().
|
inline |
Construct the container from an initializer list.
| [in] | l | initializer list of items |
| bad_alloc | if there is no enough memory, or what the copy of an item throws. Then the items already appended are freed, if the container has empty(). |
Definition at line 1166 of file ah-dry.H.
References SpecialCtors< Container, T >::build_apart(), and l.
|
inlineprivate |
Fill the container: in another one built apart, whose items it takes with swap(), if the container has a default constructor and swap(); if not, in place, freeing with free_appended() what was appended if fill throws.
Built apart, the destructor of the other container frees what it took if fill throws, and the copy costs less than in place, where the container being built must be ready for the cleanup at each append.
Definition at line 1199 of file ah-dry.H.
References fill(), SpecialCtors< Container, T >::free_appended(), and swap().
Referenced by SpecialCtors< Container, T >::SpecialCtors(), SpecialCtors< Container, T >::SpecialCtors(), and SpecialCtors< Container, T >::SpecialCtors().
|
inlineprivatenoexcept |
Free the items that a constructor of this base appended.
When such a constructor throws, the container is not built and its destructor does not run: without this, the items would leak with their nodes. A container without empty() keeps them.
Definition at line 1182 of file ah-dry.H.
Referenced by SpecialCtors< Container, T >::build_apart().
|
default |
Copy assignment; the derived container copies its items.
|
inlinenoexcept |