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

Owning type-erased input iterator with equality and ordering. More...

#include <dyn_iterator.hpp>

Public Member Functions

 dyn_comparable_input_iter ()
 Constructs an empty iterator.
 
template<typename It>
 dyn_comparable_input_iter (It it)
 Erases and owns a comparable iterator value.
 
 dyn_comparable_input_iter (dyn_comparable_input_iter< V > const &other)
 Copies the erased iterator.
 
 dyn_comparable_input_iter (dyn_comparable_input_iter< V > &&other) noexcept
 Moves the erased iterator and leaves the source empty.
 
dyn_comparable_input_iter< V > & operator= (dyn_comparable_input_iter< V > const &other)
 Copy-assigns the erased iterator.
 
dyn_comparable_input_iter< V > & operator= (dyn_comparable_input_iter< V > &&other) noexcept
 Move-assigns the erased iterator and leaves the source empty.
 
operator* () const
 Reads the current element by value.
 
dyn_comparable_input_iter< V > & operator++ ()
 Advances the erased iterator.
 
dyn_comparable_input_iter< V > operator++ (int)
 Advances and returns the previous position.
 
bool operator< (dyn_comparable_input_iter< V > const &other) const
 Orders erased iterators.
 
bool operator== (dyn_comparable_input_iter< V > const &other) const
 Compares erased iterators for equality.
 
bool operator!= (dyn_comparable_input_iter< V > const &other) const
 Compares erased iterators for inequality.
 

Detailed Description

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

Owning type-erased input iterator with equality and ordering.

Iterators that erase the same concrete type compare using that type's operators. Empty iterators compare equal; an empty iterator orders before every non-empty iterator. Default-constructed and moved-from instances must not be dereferenced or incremented.

Template Parameters
VValue type produced by dereference.

Constructor & Destructor Documentation

◆ dyn_comparable_input_iter() [1/3]

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

Erases and owns a comparable iterator value.

Template Parameters
ItConcrete iterator type.
Parameters
itIterator to store.

◆ dyn_comparable_input_iter() [2/3]

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

Copies the erased iterator.

Parameters
otherIterator to copy.

◆ dyn_comparable_input_iter() [3/3]

template<typename V>
rpnx::dyn_comparable_input_iter< V >::dyn_comparable_input_iter ( dyn_comparable_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>
bool rpnx::dyn_comparable_input_iter< V >::operator!= ( dyn_comparable_input_iter< V > const & other) const
inline

Compares erased iterators for inequality.

Parameters
otherIterator to compare.
Returns
Negation of equality.

◆ operator*()

template<typename V>
V rpnx::dyn_comparable_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_comparable_input_iter< V > & rpnx::dyn_comparable_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_comparable_input_iter< V > rpnx::dyn_comparable_input_iter< V >::operator++ ( int )
inline

Advances and returns the previous position.

Returns
Independent copy before advancement.

◆ operator<()

template<typename V>
bool rpnx::dyn_comparable_input_iter< V >::operator< ( dyn_comparable_input_iter< V > const & other) const
inline

Orders erased iterators.

Parameters
otherIterator to compare.
Returns
true when this iterator orders first.

◆ operator=() [1/2]

template<typename V>
dyn_comparable_input_iter< V > & rpnx::dyn_comparable_input_iter< V >::operator= ( dyn_comparable_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_comparable_input_iter< V > & rpnx::dyn_comparable_input_iter< V >::operator= ( dyn_comparable_input_iter< V > const & other)
inline

Copy-assigns the erased iterator.

Parameters
otherIterator to copy.
Returns
Reference to this iterator.

◆ operator==()

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

Compares erased iterators for equality.

Parameters
otherIterator to compare.
Returns
true for equal positions of the same erased type, or for two empty iterators.

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