20class AlternatingIterator {
22 using value_type =
typename Titer::value_type;
23 using difference_type = std::ptrdiff_t;
24 using iterator_category = std::forward_iterator_tag;
25 using pointer =
typename Titer::pointer;
26 using reference =
typename Titer::reference;
28 AlternatingIterator() =
default;
42 this->
position = begin ? 0 : std::distance(this->first, this->last);
57 std::strong_ordering operator<=>(
const AlternatingIterator &rhs)
const
65 inline reference operator*()
const
70 AlternatingIterator &operator++()
72 size_t size =
static_cast<size_t>(std::distance(this->
first, this->
last));
76 if (this->
position < size) this->Next();
81 AlternatingIterator operator++(
int)
83 AlternatingIterator result = *
this;
88 inline Titer Base()
const
108 this->state = this->next_state;
109 if (this->next_state) {
110 assert(this->after != this->last);
112 this->next_state = this->before == this->first;
114 assert(this->before != this->first);
116 this->next_state = std::next(this->after) != this->last;