|
Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
|
Implementation of array storing dynamicaly allocated instances of given type. The class mimicks the iterface of the standard library array, but effectively allows polymorphic objects to be stored inside. More...
#include <ptr_array.hpp>
Public Types | |
| using | value_type = T |
| The type of values. More... | |
| using | size_type = std::size_t |
| The type of sizes. More... | |
| using | diference_type = std::ptrdiff_t |
| The type of size differences. More... | |
| using | reference = value_type & |
| The type of reference to values. More... | |
| using | const_reference = const value_type & |
| The type of reference to constant values. More... | |
| using | pointer = T * |
| The type of pointer to values. More... | |
| using | const_pointer = const T * |
| The type of pointer to constant value. More... | |
| using | iterator = dereferencing_iterator< typename std::array< T *, N >::iterator > |
| The type of values iterator. More... | |
| using | const_iterator = dereferencing_iterator< typename std::array< T *, N >::const_iterator > |
| The type of constant values iterator. More... | |
| using | reverse_iterator = dereferencing_iterator< typename std::array< T *, N >::reverse_iterator > |
| The type of reverse values iterator. More... | |
| using | const_reverse_iterator = dereferencing_iterator< typename std::array< T *, N >::const_reverse_iterator > |
| The type of constant reverse values iterator. More... | |
Public Member Functions | |
| template<class ... Types> | |
| ptr_array (Types &&... args) | |
| Constructor of the array of pointers from parameter values. The resulting array is of size of the parameter pack. More... | |
| template<class R = T> | |
| ptr_array () | |
| The default constructor initializing the values of the array to the defaultly constructed value of T. More... | |
| ptr_array (const ptr_array &other) | |
| Copy constructor cloning all values in the source array. More... | |
| ptr_array (ptr_array &&other) noexcept | |
| Move constructor intended to transfer ownership of pointers from source to new instance. More... | |
| ~ptr_array () noexcept | |
| Destructor of the pointer array. More... | |
| ptr_array< T, N > & | operator= (const ptr_array< T, N > &other) |
| Copy operator of assignment. The values of the source array are cloned to the new array. More... | |
| ptr_array< T, N > & | operator= (ptr_array< T, N > &&other) noexcept |
| Move operator of assignment. The inner array of this and other instance are swapped. More... | |
| template<class R > | |
| void | fill (const R &value) |
Fills the array with copies of value. More... | |
| reference | at (size_type index) |
Getter of value on index. More... | |
| const_reference | at (size_type index) const |
Getter of value on index. More... | |
| reference | operator[] (size_type index) |
| Array subscript operator. More... | |
| const_reference | operator[] (size_type index) const |
| Array subscript operator. More... | |
| reference | front () |
| Getter of the first value in the array. More... | |
| const_reference | front () const |
| Getter of the first value in the array. More... | |
| reference | back () |
| Getter of the last value in the array. More... | |
| const_reference | back () const |
| Getter of the last value in the array. More... | |
| bool | null (size_type index) const |
Test function whether pointer on index. More... | |
| iterator | begin () &noexcept |
| Iterator to the begining of the values range in the array. More... | |
| const_iterator | begin () const &noexcept |
| Iterator to the begining of the values range in the array. More... | |
| auto | begin () &&noexcept |
| Move iterator to the begining of the values range in the array. More... | |
| const_iterator | cbegin () const noexcept |
| Iterator to the begining of the values range in the array. More... | |
| iterator | end () &noexcept |
| Iterator one past the last element of the values range in the array. More... | |
| const_iterator | end () const &noexcept |
| Iterator one past the last element of the values range in the array. More... | |
| auto | end () &&noexcept |
| Move iterator to the begining of the values range in the array. More... | |
| const_iterator | cend () const noexcept |
| Iterator one past the last element of the values range in the array. More... | |
| reverse_iterator | rbegin () noexcept |
| Reverse iterator to the begining of the reversed range of values in the array. More... | |
| const_reverse_iterator | rbegin () const noexcept |
| Reverse iterator to the begining of the reversed range of values in the array. More... | |
| const_reverse_iterator | crbegin () const noexcept |
| Reverse iterator to the begining of the reversed range of values in the array. More... | |
| reverse_iterator | rend () noexcept |
| Reverse iterator one past the last element of the reversed range of values in the array. More... | |
| const_reverse_iterator | rend () const noexcept |
| Reverse iterator one past the last element of the reversed range of values in the array. More... | |
| const_reverse_iterator | crend () const noexcept |
| Reverse iterator one past the last element of the reversed range of values in the array. More... | |
| auto | range () & |
| Make range of non-const begin to end iterators. More... | |
| auto | range () const & |
| Make range of non-const begin to end iterators. More... | |
| auto | range () && |
| Make range of move begin to end iterators. More... | |
| bool | empty () const noexcept |
| Array emptines test. More... | |
| size_type | size () const noexcept |
| Getter of the array size. More... | |
| size_type | max_size () const noexcept |
| Returns the maximal number of values possible to store inside the container. More... | |
| template<class R > | |
| iterator | set (const_iterator pos, R &&value) |
Setter of value in the array on position specified by iterator specified by pos. The value is cloned from the value. More... | |
| template<class R > | |
| iterator | set (const_reverse_iterator pos, R &&value) |
Setter of value in the array on position specified by iterator specified by pos. The value is cloned from the value. More... | |
| template<class R , class ... Args> | |
| iterator | emplace_set (const_iterator pos, Args &&... args) |
Setter of internaly constructed value into the array on position specified by iterator specified by pos. The value is constructed from paramter pack. More... | |
| template<class R , class ... Args> | |
| iterator | emplace_set (const_reverse_iterator pos, Args &&... args) |
Setter of internaly constructed value into the array on position specified by iterator specified by pos. The value is constructed from paramter pack. More... | |
| void | swap (ptr_array &other) |
| template<std::size_t I> | |
| auto & | get () & |
| Getter of value on index given by template paramter. More... | |
| template<std::size_t I> | |
| const auto & | get () const & |
| Getter of value on index given by template paramter. More... | |
| template<std::size_t I> | |
| auto && | get () && |
| Getter of value on index given by template paramter. More... | |
| auto | operator<=> (const ext::ptr_array< T, N > &second) const |
| bool | operator== (const ext::ptr_array< T, N > &second) const |
| Specialisation of equality operator for pointer array. More... | |
Implementation of array storing dynamicaly allocated instances of given type. The class mimicks the iterface of the standard library array, but effectively allows polymorphic objects to be stored inside.
| T | the type of stored values |
| N | the size of the array |
| using ext::ptr_array< T, N >::const_iterator = dereferencing_iterator < typename std::array < T *, N >::const_iterator > |
The type of constant values iterator.
| using ext::ptr_array< T, N >::const_pointer = const T * |
The type of pointer to constant value.
| using ext::ptr_array< T, N >::const_reference = const value_type & |
The type of reference to constant values.
| using ext::ptr_array< T, N >::const_reverse_iterator = dereferencing_iterator < typename std::array < T *, N >::const_reverse_iterator > |
The type of constant reverse values iterator.
| using ext::ptr_array< T, N >::diference_type = std::ptrdiff_t |
The type of size differences.
| using ext::ptr_array< T, N >::iterator = dereferencing_iterator < typename std::array < T *, N >::iterator > |
The type of values iterator.
| using ext::ptr_array< T, N >::pointer = T * |
The type of pointer to values.
| using ext::ptr_array< T, N >::reference = value_type & |
The type of reference to values.
| using ext::ptr_array< T, N >::reverse_iterator = dereferencing_iterator < typename std::array < T *, N >::reverse_iterator > |
The type of reverse values iterator.
| using ext::ptr_array< T, N >::size_type = std::size_t |
The type of sizes.
| using ext::ptr_array< T, N >::value_type = T |
The type of values.
|
inline |
Constructor of the array of pointers from parameter values. The resulting array is of size of the parameter pack.
| Types | ... the pack of source values type |
| args | ... the actual source parameters |
|
inline |
The default constructor initializing the values of the array to the defaultly constructed value of T.
| R | the actual value to default construct on every array index |
|
inline |
Copy constructor cloning all values in the source array.
| other | the source array |
|
inlinenoexcept |
Move constructor intended to transfer ownership of pointers from source to new instance.
| other | the source array |
|
inlinenoexcept |
Destructor of the pointer array.
|
inline |
Getter of value on index.
| index | the position to access |
|
inline |
Getter of value on index.
| index | the position to access |
|
inline |
Getter of the last value in the array.
|
inline |
Getter of the last value in the array.
|
inlinenoexcept |
Move iterator to the begining of the values range in the array.
|
inlinenoexcept |
Iterator to the begining of the values range in the array.
|
inlinenoexcept |
Iterator to the begining of the values range in the array.
|
inlinenoexcept |
Iterator to the begining of the values range in the array.
|
inlinenoexcept |
Iterator one past the last element of the values range in the array.
|
inlinenoexcept |
Reverse iterator to the begining of the reversed range of values in the array.
|
inlinenoexcept |
Reverse iterator one past the last element of the reversed range of values in the array.
|
inline |
Setter of internaly constructed value into the array on position specified by iterator specified by pos. The value is constructed from paramter pack.
| R | the actual type of constructed value |
| Args | ... types of value constructor parameters |
| pos | the iterator specifying position to set |
| args | ... value constructor parameters |
|
inline |
Setter of internaly constructed value into the array on position specified by iterator specified by pos. The value is constructed from paramter pack.
| R | the actual type of constructed value |
| Args | ... types of value constructor parameters |
| pos | the iterator specifying position to set |
| args | ... value constructor parameters |
|
inlinenoexcept |
Array emptines test.
|
inlinenoexcept |
Move iterator to the begining of the values range in the array.
|
inlinenoexcept |
Iterator one past the last element of the values range in the array.
|
inlinenoexcept |
Iterator one past the last element of the values range in the array.
|
inline |
Fills the array with copies of value.
| value | the filling value |
|
inline |
Getter of the first value in the array.
|
inline |
Getter of the first value in the array.
|
inline |
Getter of value on index given by template paramter.
| I | the index to access |
|
inline |
Getter of value on index given by template paramter.
| I | the index to access |
|
inline |
Getter of value on index given by template paramter.
| I | the index to access |
|
inlinenoexcept |
Returns the maximal number of values possible to store inside the container.
|
inline |
Test function whether pointer on index.
| index | the tested index |
index is null
|
inline |
|
inline |
Copy operator of assignment. The values of the source array are cloned to the new array.
| other | the source instance |
|
inlinenoexcept |
Move operator of assignment. The inner array of this and other instance are swapped.
| other | the source instance |
|
inline |
Specialisation of equality operator for pointer array.
| T | the type of values inside the array |
| N | the size of the array |
| first | the first compared value |
| second | the second compared value |
|
inline |
Array subscript operator.
| the | index to retrieve |
|
inline |
Array subscript operator.
| the | index to retrieve |
|
inline |
Make range of non-const begin to end iterators.
|
inline |
Make range of move begin to end iterators.
|
inline |
Make range of non-const begin to end iterators.
|
inlinenoexcept |
Reverse iterator to the begining of the reversed range of values in the array.
|
inlinenoexcept |
Reverse iterator to the begining of the reversed range of values in the array.
|
inlinenoexcept |
Reverse iterator one past the last element of the reversed range of values in the array.
|
inlinenoexcept |
Reverse iterator one past the last element of the reversed range of values in the array.
|
inline |
Setter of value in the array on position specified by iterator specified by pos. The value is cloned from the value.
| R | the actual type of constructed value |
| pos | the iterator specifying position to set |
| value | the value to place at given position |
|
inline |
Setter of value in the array on position specified by iterator specified by pos. The value is cloned from the value.
| R | the actual type of constructed value |
| pos | the iterator specifying position to set |
| value | the value to place at given position |
|
inlinenoexcept |
Getter of the array size.
|
inline |
Swaps two instances of pointer array
| x | the other instance to swap with |