Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::category::unfold_view< S, Coalg >::iterator Class Reference

A position of the walk: the element, the next state, live. More...

Public Types

using value_type = element_type
using difference_type = std::ptrdiff_t
using iterator_concept = std::forward_iterator_tag

Public Member Functions

constexpr iterator (const S &seed, Coalg step)
constexpr value_type operator* () const
constexpr iterator & operator++ ()
 Unfold the next state.
constexpr iterator operator++ (int)

Friends

constexpr bool operator== (const iterator &a, const iterator &b)
constexpr bool operator== (const iterator &it, std::default_sentinel_t)

Detailed Description

template<std::regular S, std::semiregular Coalg>
class dedekind::category::unfold_view< S, Coalg >::iterator

A position of the walk: the element, the next state, live.

Constructor & Destructor Documentation

◆ iterator()

template<std::regular S, std::semiregular Coalg>
dedekind::category::unfold_view< S, Coalg >::iterator::iterator ( const S & seed,
Coalg step )
inlineconstexpr
Parameters
seedthe first state.
stepthe coalgebra.

Member Function Documentation

◆ operator*()

template<std::regular S, std::semiregular Coalg>
value_type dedekind::category::unfold_view< S, Coalg >::iterator::operator* ( ) const
inlineconstexpr
Returns
the current element, by value.

◆ operator++() [1/2]

template<std::regular S, std::semiregular Coalg>
iterator & dedekind::category::unfold_view< S, Coalg >::iterator::operator++ ( )
inlineconstexpr

Unfold the next state.

Returns
this iterator.

◆ operator++() [2/2]

template<std::regular S, std::semiregular Coalg>
iterator dedekind::category::unfold_view< S, Coalg >::iterator::operator++ ( int )
inlineconstexpr
Returns
the position before the step.

◆ operator== [1/2]

template<std::regular S, std::semiregular Coalg>
bool operator== ( const iterator & a,
const iterator & b )
friend
Returns
whether two positions of one walk coincide: the same source state, so, the coalgebra being a function, the same element and the same next state; the element need not be comparable. (The next state alone would not do: a step that is not injective reaches one state from two, whose elements differ.)

◆ operator== [2/2]

template<std::regular S, std::semiregular Coalg>
bool operator== ( const iterator & it,
std::default_sentinel_t  )
friend
Returns
whether the walk has ended.

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