19 template<
class V,
class T>
120 while (first != _this()) {
180 return *_this().get();
189 return *_this().get();
217 return !(_this() == other);
227 return !(_this() >= other);
237 return _this() == other || _this() > other;
247 return _this() == other || _this() < other;
257 return _this().eq(other);
267 return _this().gt(other);
272 return *
static_cast<iterator *
>(
this);
276 return *
static_cast<const iterator *
>(
this);
283 template<
class V,
class It>
322 if (_pos == _begin) {
336 return *_pos == *other._pos;
362 template<
class V,
class It>
CRTP base that provides iterator operators for round-robin iterators.
Definition round_robin.h:20
iterator operator+(diff_t step)
Return a copy advanced by a wrapped offset.
Definition round_robin.h:94
bool operator==(const iterator &other) const
Compare whether two wrapped iterator positions are equal.
Definition round_robin.h:256
bool operator>=(const iterator &other) const
Compare whether this wrapped position sorts at or after another one.
Definition round_robin.h:236
bool operator<=(const iterator &other) const
Compare whether this wrapped position sorts at or before another one.
Definition round_robin.h:246
diff_t operator-(iterator first)
Count wrapped increments needed to reach this iterator from another one.
Definition round_robin.h:118
bool operator<(const iterator &other) const
Compare whether this wrapped position sorts before another one.
Definition round_robin.h:226
iterator operator++(int)
Advance to the next element and return the previous iterator position.
Definition round_robin.h:153
bool operator!=(const iterator &other) const
Compare whether two wrapped iterator positions differ.
Definition round_robin.h:216
V difference_type
Difference type used for iterator movement.
Definition round_robin.h:33
reference operator*()
Dereference the current element in the cycled range.
Definition round_robin.h:179
V value_type
Value type exposed by the wrapped iterator.
Definition round_robin.h:29
T iterator
Concrete iterator type supplied by the CRTP child.
Definition round_robin.h:54
pointer operator->()
Access the current element in the cycled range.
Definition round_robin.h:197
V const * const_pointer
Const pointer to a value in the cycled range.
Definition round_robin.h:41
V & reference
Mutable reference to a value in the cycled range.
Definition round_robin.h:45
iterator operator+=(diff_t step)
Advance this iterator by repeatedly wrapping at the end of the range.
Definition round_robin.h:66
iterator operator--()
Move to the previous element, wrapping to the end when needed.
Definition round_robin.h:143
iterator operator-=(diff_t step)
Move this iterator backward by repeatedly wrapping at the beginning of the range.
Definition round_robin.h:80
const_reference operator*() const
Dereference the current element in the cycled range.
Definition round_robin.h:188
iterator operator++()
Advance to the next element, wrapping back to the beginning when needed.
Definition round_robin.h:133
bool operator>(const iterator &other) const
Compare whether this wrapped position sorts after another one.
Definition round_robin.h:266
const_pointer operator->() const
Access the current element in the cycled range.
Definition round_robin.h:206
std::random_access_iterator_tag iterator_category
Iterator category advertised to standard algorithms.
Definition round_robin.h:25
iterator operator-(diff_t step)
Return a copy moved backward by a wrapped offset.
Definition round_robin.h:106
V const & const_reference
Const reference to a value in the cycled range.
Definition round_robin.h:49
V * pointer
Mutable pointer to a value in the cycled range.
Definition round_robin.h:37
std::ptrdiff_t diff_t
Signed offset type used when moving through the range.
Definition round_robin.h:58
iterator operator--(int)
Move to the previous element and return the previous iterator position.
Definition round_robin.h:166
Iterator that cycles indefinitely over a fixed begin/end range.
Definition round_robin.h:284
bool eq(const round_robin_t &other) const
Compare two iterators for equality.
Definition round_robin.h:335
void dec()
Move the iterator to the previous element.
Definition round_robin.h:321
V * pointer
Mutable pointer to values in the cycled range.
Definition round_robin.h:293
It iterator
Underlying iterator type for the cycled range.
Definition round_robin.h:289
round_robin_t(iterator begin, iterator end)
Construct a round-robin iterator over a fixed range.
Definition round_robin.h:301
pointer get() const
Return the currently wrapped value or handle.
Definition round_robin.h:344
void inc()
Advance the iterator to the next element.
Definition round_robin.h:310
A round-robin iterator utility.
Definition round_robin.h:15
round_robin_t< V, It > make_round_robin(It begin, It end)
Create a round-robin iterator over a fixed range.
Definition round_robin.h:363