RPNX::DataStructures
Header-only C++ data structures and supporting utilities.
Loading...
Searching...
No Matches
rpnx::dyn_input_iter< V > Class Template Reference

Owning type-erased input iterator that yields values by copy. More...

#include <dyn_iterator.hpp>

Public Member Functions

 dyn_input_iter ()
 Constructs an empty iterator.
 
template<typename It>
 dyn_input_iter (It it)
 Erases and owns an iterator value.
 
 dyn_input_iter (dyn_input_iter< V > const &other)
 Copies the erased iterator.
 
 dyn_input_iter (dyn_input_iter< V > &&other) noexcept
 Moves the erased iterator and leaves the source empty.
 
dyn_input_iter< V > & operator= (dyn_input_iter< V > const &other)
 Copy-assigns the erased iterator.
 
dyn_input_iter< V > & operator= (dyn_input_iter< V > &&other) noexcept
 Move-assigns the erased iterator and leaves the source empty.
 
operator* () const
 Reads the current element by value.
 
dyn_input_iter< V > & operator++ ()
 Advances the erased iterator.
 
dyn_input_iter< V > operator++ (int)
 Advances and returns the previous position.
 

Detailed Description

template<typename V>
class rpnx::dyn_input_iter< V >

Owning type-erased input iterator that yields values by copy.

The erased iterator is heap allocated and must be copy constructible. Default-constructed and moved-from instances are empty and may only be destroyed or assigned.

Template Parameters
VValue type produced by dereference.

Constructor & Destructor Documentation

◆ dyn_input_iter() [1/3]

template<typename V>
template<typename It>
rpnx::dyn_input_iter< V >::dyn_input_iter ( It it)
inline

Erases and owns an iterator value.

Template Parameters
ItConcrete iterator type.
Parameters
itIterator to store.

◆ dyn_input_iter() [2/3]

template<typename V>
rpnx::dyn_input_iter< V >::dyn_input_iter ( dyn_input_iter< V > const & other)
inline

Copies the erased iterator.

Parameters
otherIterator to copy.

◆ dyn_input_iter() [3/3]

template<typename V>
rpnx::dyn_input_iter< V >::dyn_input_iter ( dyn_input_iter< V > && other)
inlinenoexcept

Moves the erased iterator and leaves the source empty.

Parameters
otherIterator to move.

Member Function Documentation

◆ operator*()

template<typename V>
V rpnx::dyn_input_iter< V >::operator* ( ) const
inline

Reads the current element by value.

Returns
Copy or conversion of the referenced element.
Precondition
The iterator is non-empty and dereferenceable.

◆ operator++() [1/2]

template<typename V>
dyn_input_iter< V > & rpnx::dyn_input_iter< V >::operator++ ( )
inline

Advances the erased iterator.

Returns
Reference to this iterator.
Precondition
The iterator is non-empty and incrementable.

◆ operator++() [2/2]

template<typename V>
dyn_input_iter< V > rpnx::dyn_input_iter< V >::operator++ ( int )
inline

Advances and returns the previous position.

Returns
Independent copy before advancement.

◆ operator=() [1/2]

template<typename V>
dyn_input_iter< V > & rpnx::dyn_input_iter< V >::operator= ( dyn_input_iter< V > && other)
inlinenoexcept

Move-assigns the erased iterator and leaves the source empty.

Parameters
otherIterator to move.
Returns
Reference to this iterator.

◆ operator=() [2/2]

template<typename V>
dyn_input_iter< V > & rpnx::dyn_input_iter< V >::operator= ( dyn_input_iter< V > const & other)
inline

Copy-assigns the erased iterator.

Parameters
otherIterator to copy.
Returns
Reference to this iterator.

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