![]() |
libdl
0.0.1
Simple yet powerful deep learning
|
Represents a generic iterator that can be initialized to hold any other class instance that satisfies the std::input_or_output_iterator concept. More...
#include <generic_iterator.hpp>
Public Types | |
using | iterator_category = std::input_iterator_tag |
using | difference_type = std::ptrdiff_t |
using | value_type = T |
using | pointer = T * |
using | reference = T & |
Public Member Functions | |
GenericIterator () | |
Default constructor that creates a nullptr-iterator. | |
GenericIterator (const GenericIterator< T > &other) | |
Copy-constructs a new generic iterator. | |
GenericIterator (GenericIterator< T > &&other) | |
Move-constructs a new generic iterator. | |
template<std::input_or_output_iterator TIt> | |
GenericIterator (TIt iterator) noexcept | |
Constructs a new GenericIterator from the provided arbitrary object that satisfies the std::input_or_output_iterator concept. | |
template<std::input_or_output_iterator TIt> | |
GenericIterator (TIt iterator, std::shared_ptr< auto > userdata) noexcept | |
Constructs a new GenericIterator from the provided arbitrary object that satisfies the std::input_or_output_iterator concept. The additional userdata parameter can keep the underlying data that the iterator iterates over such that it is not deleted as long as at least one iterator is still alive. | |
GenericIterator< T > & | operator= (const GenericIterator< T > &other) noexcept |
Assignment opterator. | |
GenericIterator< T > & | operator= (GenericIterator< T > &&other) noexcept |
Move-assignment operator. | |
T | operator* () const |
Dereferences the iterator. That is, returns the data it currently points at. | |
GenericIterator< T > & | operator++ () noexcept |
Increments the iterator. That is, advancing it forward by one. | |
GenericIterator< T > | operator++ (int) noexcept |
Late increments the iterator. That is, advances the iterator by one but returns a copy of the iterator prior to advancing. | |
bool | operator== (const GenericIterator< T > &other) const |
Checks if this iterator is equal to the provided one. | |
Represents a generic iterator that can be initialized to hold any other class instance that satisfies the std::input_or_output_iterator concept.
Represents a generic iterator that can be initialized to hold any other class instance that satisfies the std::input_or_output_iterator concept. For example consider the following code:
begin
and end
again are valid iterators but they are not specific to the container they iterate through.
T | the type of the elements being iterated. |
Definition at line 24 of file generic_iterator.hpp.
using dl::utils::GenericIterator< T >::difference_type = std::ptrdiff_t |
Definition at line 143 of file generic_iterator.hpp.
using dl::utils::GenericIterator< T >::iterator_category = std::input_iterator_tag |
Definition at line 142 of file generic_iterator.hpp.
using dl::utils::GenericIterator< T >::pointer = T* |
Definition at line 145 of file generic_iterator.hpp.
using dl::utils::GenericIterator< T >::reference = T& |
Definition at line 146 of file generic_iterator.hpp.
using dl::utils::GenericIterator< T >::value_type = T |
Definition at line 144 of file generic_iterator.hpp.
|
inline |
Default constructor that creates a nullptr-iterator.
Definition at line 151 of file generic_iterator.hpp.
|
inline |
Copy-constructs a new generic iterator.
other | The iterator to copy. |
Definition at line 158 of file generic_iterator.hpp.
|
inline |
Move-constructs a new generic iterator.
other | The iterator to move. |
Definition at line 165 of file generic_iterator.hpp.
|
inlineexplicitnoexcept |
Constructs a new GenericIterator from the provided arbitrary object that satisfies the std::input_or_output_iterator concept.
TIt | The datatype of the underlying iterator. |
iterator | The underlying iterator. |
Definition at line 176 of file generic_iterator.hpp.
|
inlinenoexcept |
Constructs a new GenericIterator from the provided arbitrary object that satisfies the std::input_or_output_iterator concept. The additional userdata parameter can keep the underlying data that the iterator iterates over such that it is not deleted as long as at least one iterator is still alive.
TIt | The datatype of the underlying iterator. |
iterator | The underlying iterator. |
userdata | (Optional) additional userdata holding the data the iterator iterates over. |
Definition at line 189 of file generic_iterator.hpp.
|
inline |
Dereferences the iterator. That is, returns the data it currently points at.
Definition at line 219 of file generic_iterator.hpp.
|
inlinenoexcept |
Increments the iterator. That is, advancing it forward by one.
Definition at line 225 of file generic_iterator.hpp.
|
inlinenoexcept |
Late increments the iterator. That is, advances the iterator by one but returns a copy of the iterator prior to advancing.
Definition at line 235 of file generic_iterator.hpp.
|
inlinenoexcept |
Assignment opterator.
other |
Definition at line 198 of file generic_iterator.hpp.
|
inlinenoexcept |
Move-assignment operator.
other |
Definition at line 209 of file generic_iterator.hpp.
|
inline |
Checks if this iterator is equal to the provided one.
other | The iterator to check equality against. |
other
. Definition at line 246 of file generic_iterator.hpp.