ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::CircularIterator< T, Const > Class Template Reference

the random-access iterator on the items of a circular vector of the capacity \( c \) whose first item is at the place \( \mathit{head} \), the item \( i \) at the place \( ( \mathit{head} + i ) \bmod c \) More...

#include <ADS/Iterators.h>

Public types

using iterator_category = std::random_access_iterator_tag
 random access
using value_type = T
 the items
using difference_type = std::ptrdiff_t
 the distances
using reference = Item &
 a reference to an item
using pointer = Item *
 a pointer to an item

Public member functions

 CircularIterator (void)=default
 an iterator on no vector
 CircularIterator (Item *A, std::size_t head, std::size_t capacity, difference_type i)
 on the item \( i \) from the head of the vector \( A \)
template<bool K>
requires ( Const && ! K )
 CircularIterator (const CircularIterator< T, K > &o)
 the constant iterator from the mutable one
reference operator* (void) const
 the item
pointer operator-> (void) const
 the address of the item
reference operator[] (difference_type k) const
 the item \( k \) places on, at the place \( ( \mathit{head} + i + k ) \bmod c \)
CircularIterator & operator++ (void)
 to the next item
CircularIterator & operator-- (void)
 to the previous item
CircularIterator operator++ (int)
 to the next item, returning the iterator before the step
CircularIterator operator-- (int)
 to the previous item, returning the iterator before the step
CircularIterator & operator+= (difference_type k)
 \( k \) items on
CircularIterator & operator-= (difference_type k)
 \( k \) items back
bool operator== (const CircularIterator &o) const
 equal on the same index from the head
std::strong_ordering operator<=> (const CircularIterator &o) const
 the order of the indices from the head
Item * base (void) const
 the vector
std::size_t head (void) const
 the place of the first item
std::size_t capacity (void) const
 the capacity \( c \) of the vector
difference_type index (void) const
 the index \( i \) of the item from the head

Friends

CircularIterator operator+ (CircularIterator a, difference_type k)
CircularIterator operator+ (difference_type k, CircularIterator a)
CircularIterator operator- (CircularIterator a, difference_type k)
difference_type operator- (const CircularIterator &a, const CircularIterator &b)

Detailed description

template<class T, bool Const = true>
class ADS::CircularIterator< T, Const >

the random-access iterator on the items of a circular vector of the capacity \( c \) whose first item is at the place \( \mathit{head} \), the item \( i \) at the place \( ( \mathit{head} + i ) \bmod c \)

Member typedef documentation

◆ difference_type

template<class T, bool Const = true>
using ADS::CircularIterator< T, Const >::difference_type = std::ptrdiff_t

the distances

◆ iterator_category

template<class T, bool Const = true>
using ADS::CircularIterator< T, Const >::iterator_category = std::random_access_iterator_tag

random access

◆ pointer

template<class T, bool Const = true>
using ADS::CircularIterator< T, Const >::pointer = Item *

a pointer to an item

◆ reference

template<class T, bool Const = true>
using ADS::CircularIterator< T, Const >::reference = Item &

a reference to an item

◆ value_type

template<class T, bool Const = true>
using ADS::CircularIterator< T, Const >::value_type = T

the items

Constructor and destructor documentation

◆ CircularIterator() [1/3]

template<class T, bool Const = true>
ADS::CircularIterator< T, Const >::CircularIterator ( void )
default

an iterator on no vector

◆ CircularIterator() [2/3]

template<class T, bool Const = true>
ADS::CircularIterator< T, Const >::CircularIterator ( Item * A,
std::size_t head,
std::size_t capacity,
difference_type i )
inline

on the item \( i \) from the head of the vector \( A \)

◆ CircularIterator() [3/3]

template<class T, bool Const = true>
template<bool K>
requires ( Const && ! K )
ADS::CircularIterator< T, Const >::CircularIterator ( const CircularIterator< T, K > & o)
inline

the constant iterator from the mutable one

Member function documentation

◆ base()

template<class T, bool Const = true>
Item * ADS::CircularIterator< T, Const >::base ( void ) const
inlinenodiscard

the vector

◆ capacity()

template<class T, bool Const = true>
std::size_t ADS::CircularIterator< T, Const >::capacity ( void ) const
inlinenodiscard

the capacity \( c \) of the vector

◆ head()

template<class T, bool Const = true>
std::size_t ADS::CircularIterator< T, Const >::head ( void ) const
inlinenodiscard

the place of the first item

◆ index()

template<class T, bool Const = true>
difference_type ADS::CircularIterator< T, Const >::index ( void ) const
inlinenodiscard

the index \( i \) of the item from the head

◆ operator*()

template<class T, bool Const = true>
reference ADS::CircularIterator< T, Const >::operator* ( void ) const
inline

the item

◆ operator++() [1/2]

template<class T, bool Const = true>
CircularIterator ADS::CircularIterator< T, Const >::operator++ ( int )
inline

to the next item, returning the iterator before the step

◆ operator++() [2/2]

template<class T, bool Const = true>
CircularIterator & ADS::CircularIterator< T, Const >::operator++ ( void )
inline

to the next item

◆ operator+=()

template<class T, bool Const = true>
CircularIterator & ADS::CircularIterator< T, Const >::operator+= ( difference_type k)
inline

\( k \) items on

◆ operator--() [1/2]

template<class T, bool Const = true>
CircularIterator ADS::CircularIterator< T, Const >::operator-- ( int )
inline

to the previous item, returning the iterator before the step

◆ operator--() [2/2]

template<class T, bool Const = true>
CircularIterator & ADS::CircularIterator< T, Const >::operator-- ( void )
inline

to the previous item

◆ operator-=()

template<class T, bool Const = true>
CircularIterator & ADS::CircularIterator< T, Const >::operator-= ( difference_type k)
inline

\( k \) items back

◆ operator->()

template<class T, bool Const = true>
pointer ADS::CircularIterator< T, Const >::operator-> ( void ) const
inline

the address of the item

◆ operator<=>()

template<class T, bool Const = true>
std::strong_ordering ADS::CircularIterator< T, Const >::operator<=> ( const CircularIterator< T, Const > & o) const
inline

the order of the indices from the head

◆ operator==()

template<class T, bool Const = true>
bool ADS::CircularIterator< T, Const >::operator== ( const CircularIterator< T, Const > & o) const
inline

equal on the same index from the head

◆ operator[]()

template<class T, bool Const = true>
reference ADS::CircularIterator< T, Const >::operator[] ( difference_type k) const
inline

the item \( k \) places on, at the place \( ( \mathit{head} + i + k ) \bmod c \)

◆ operator+ [1/2]

template<class T, bool Const = true>
CircularIterator operator+ ( CircularIterator< T, Const > a,
difference_type k )
friend

◆ operator+ [2/2]

template<class T, bool Const = true>
CircularIterator operator+ ( difference_type k,
CircularIterator< T, Const > a )
friend

◆ operator- [1/2]

template<class T, bool Const = true>
CircularIterator operator- ( CircularIterator< T, Const > a,
difference_type k )
friend

◆ operator- [2/2]

template<class T, bool Const = true>
difference_type operator- ( const CircularIterator< T, Const > & a,
const CircularIterator< T, Const > & b )
friend

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