Sunshine master
Self-hosted game stream host for Moonlight.
round_robin_util::it_wrap_t< V, T > Class Template Reference

CRTP base that provides iterator operators for round-robin iterators. More...

#include <src/round_robin.h>

Public Types

using const_pointer = V const *
 Const pointer to a value in the cycled range.
 
using const_reference = V const &
 Const reference to a value in the cycled range.
 
typedef std::ptrdiff_t diff_t
 Signed offset type used when moving through the range.
 
using difference_type = V
 Difference type used for iterator movement.
 
typedef T iterator
 Concrete iterator type supplied by the CRTP child.
 
using iterator_category = std::random_access_iterator_tag
 Iterator category advertised to standard algorithms.
 
using pointer = V *
 Mutable pointer to a value in the cycled range.
 
using reference = V &
 Mutable reference to a value in the cycled range.
 
using value_type = V
 Value type exposed by the wrapped iterator.
 

Public Member Functions

bool operator!= (const iterator &other) const
 Compare whether two wrapped iterator positions differ.
 
reference operator* ()
 Dereference the current element in the cycled range.
 
const_reference operator* () const
 Dereference the current element in the cycled range.
 
iterator operator+ (diff_t step)
 Return a copy advanced by a wrapped offset.
 
iterator operator++ ()
 Advance to the next element, wrapping back to the beginning when needed.
 
iterator operator++ (int)
 Advance to the next element and return the previous iterator position.
 
iterator operator+= (diff_t step)
 Advance this iterator by repeatedly wrapping at the end of the range.
 
iterator operator- (diff_t step)
 Return a copy moved backward by a wrapped offset.
 
diff_t operator- (iterator first)
 Count wrapped increments needed to reach this iterator from another one.
 
iterator operator-- ()
 Move to the previous element, wrapping to the end when needed.
 
iterator operator-- (int)
 Move to the previous element and return the previous iterator position.
 
iterator operator-= (diff_t step)
 Move this iterator backward by repeatedly wrapping at the beginning of the range.
 
pointer operator-> ()
 Access the current element in the cycled range.
 
const_pointer operator-> () const
 Access the current element in the cycled range.
 
bool operator< (const iterator &other) const
 Compare whether this wrapped position sorts before another one.
 
bool operator<= (const iterator &other) const
 Compare whether this wrapped position sorts at or before another one.
 
bool operator== (const iterator &other) const
 Compare whether two wrapped iterator positions are equal.
 
bool operator> (const iterator &other) const
 Compare whether this wrapped position sorts after another one.
 
bool operator>= (const iterator &other) const
 Compare whether this wrapped position sorts at or after another one.
 

Detailed Description

template<class V, class T>
class round_robin_util::it_wrap_t< V, T >

CRTP base that provides iterator operators for round-robin iterators.

Member Function Documentation

◆ operator!=()

template<class V , class T >
bool round_robin_util::it_wrap_t< V, T >::operator!= ( const iterator & other) const
inline

Compare whether two wrapped iterator positions differ.

Parameters
otherIterator position to compare against.
Returns
True when the iterators do not refer to the same position.

◆ operator*() [1/2]

template<class V , class T >
reference round_robin_util::it_wrap_t< V, T >::operator* ( )
inline

Dereference the current element in the cycled range.

Returns
Mutable reference to the current value.

◆ operator*() [2/2]

template<class V , class T >
const_reference round_robin_util::it_wrap_t< V, T >::operator* ( ) const
inline

Dereference the current element in the cycled range.

Returns
Const reference to the current value.

◆ operator+()

template<class V , class T >
iterator round_robin_util::it_wrap_t< V, T >::operator+ ( diff_t step)
inline

Return a copy advanced by a wrapped offset.

Parameters
stepNumber of positions to advance.
Returns
Advanced iterator copy.

◆ operator++() [1/2]

template<class V , class T >
iterator round_robin_util::it_wrap_t< V, T >::operator++ ( )
inline

Advance to the next element, wrapping back to the beginning when needed.

Returns
Iterator after advancing.

◆ operator++() [2/2]

template<class V , class T >
iterator round_robin_util::it_wrap_t< V, T >::operator++ ( int )
inline

Advance to the next element and return the previous iterator position.

Returns
Iterator position before advancing.

◆ operator+=()

template<class V , class T >
iterator round_robin_util::it_wrap_t< V, T >::operator+= ( diff_t step)
inline

Advance this iterator by repeatedly wrapping at the end of the range.

Parameters
stepNumber of positions to advance.
Returns
Iterator positioned after the requested number of wrapped increments.

◆ operator-() [1/2]

template<class V , class T >
iterator round_robin_util::it_wrap_t< V, T >::operator- ( diff_t step)
inline

Return a copy moved backward by a wrapped offset.

Parameters
stepNumber of positions to rewind.
Returns
Rewound iterator copy.

◆ operator-() [2/2]

template<class V , class T >
diff_t round_robin_util::it_wrap_t< V, T >::operator- ( iterator first)
inline

Count wrapped increments needed to reach this iterator from another one.

Parameters
firstIterator used as the starting position.
Returns
Number of increments from first to this iterator.

◆ operator--() [1/2]

template<class V , class T >
iterator round_robin_util::it_wrap_t< V, T >::operator-- ( )
inline

Move to the previous element, wrapping to the end when needed.

Returns
Iterator after moving backward.

◆ operator--() [2/2]

template<class V , class T >
iterator round_robin_util::it_wrap_t< V, T >::operator-- ( int )
inline

Move to the previous element and return the previous iterator position.

Returns
Iterator position before moving backward.

◆ operator-=()

template<class V , class T >
iterator round_robin_util::it_wrap_t< V, T >::operator-= ( diff_t step)
inline

Move this iterator backward by repeatedly wrapping at the beginning of the range.

Parameters
stepNumber of positions to rewind.
Returns
Iterator positioned after the requested number of wrapped decrements.

◆ operator->() [1/2]

template<class V , class T >
pointer round_robin_util::it_wrap_t< V, T >::operator-> ( )
inline

Access the current element in the cycled range.

Returns
Mutable pointer to the current value.

◆ operator->() [2/2]

template<class V , class T >
const_pointer round_robin_util::it_wrap_t< V, T >::operator-> ( ) const
inline

Access the current element in the cycled range.

Returns
Const pointer to the current value.

◆ operator<()

template<class V , class T >
bool round_robin_util::it_wrap_t< V, T >::operator< ( const iterator & other) const
inline

Compare whether this wrapped position sorts before another one.

Parameters
otherIterator position to compare against.
Returns
True when this iterator is ordered before other.

◆ operator<=()

template<class V , class T >
bool round_robin_util::it_wrap_t< V, T >::operator<= ( const iterator & other) const
inline

Compare whether this wrapped position sorts at or before another one.

Parameters
otherIterator position to compare against.
Returns
True when this iterator is ordered at or before other.

◆ operator==()

template<class V , class T >
bool round_robin_util::it_wrap_t< V, T >::operator== ( const iterator & other) const
inline

Compare whether two wrapped iterator positions are equal.

Parameters
otherIterator position to compare against.
Returns
True when the iterators refer to the same wrapped position.

◆ operator>()

template<class V , class T >
bool round_robin_util::it_wrap_t< V, T >::operator> ( const iterator & other) const
inline

Compare whether this wrapped position sorts after another one.

Parameters
otherIterator position to compare against.
Returns
True when this iterator is ordered after other.

◆ operator>=()

template<class V , class T >
bool round_robin_util::it_wrap_t< V, T >::operator>= ( const iterator & other) const
inline

Compare whether this wrapped position sorts at or after another one.

Parameters
otherIterator position to compare against.
Returns
True when this iterator is ordered at or after other.

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