Audio Processing Framework (APF) version 0.5.0
List of all members
apf::circular_iterator< I > Class Template Reference

Circular iterator class. More...

#include <apf/iterator.h>

Public Types

Type Definitions from the Underlying Iterator
using iterator_category = typename std::iterator_traits< I >::iterator_category
 
using value_type = typename std::iterator_traits< I >::value_type
 
using difference_type = typename std::iterator_traits< I >::difference_type
 
using pointer = typename std::iterator_traits< I >::pointer
 
using reference = typename std::iterator_traits< I >::reference
 

Public Member Functions

Constructors

Copy ctor and assignment operator are auto-generated by the compiler.

 circular_iterator (I begin, I end, I current)
 Constructor with explicit current iterator. More...
 
 circular_iterator (I begin, I end)
 Constructor with implicit current iterator. More...
 
 circular_iterator (I begin)
 Constructor from one iterator. More...
 
 circular_iterator ()
 Default constructor. More...
 

Operators

operator<, operator<=, operator>, operator>= don't make sense!

selfoperator++ ()
 Preincrement operator. More...
 
selfoperator-- ()
 Predecrement operator. More...
 
selfoperator+= (difference_type n)
 Addition/assignment operator. More...
 
reference operator* () const
 Straightforward dereference operator. More...
 
pointer operator-> () const
 Straightforward arrow operator. More...
 
bool operator== (const self &rhs) const
 Straightforward equality operator. More...
 
bool operator!= (const self &rhs) const
 Unequality operator (using equality operator). More...
 
reference operator[] (difference_type n) const
 Straightforward subscript operator (using + and dereference op). More...
 
self operator++ (int)
 Postincrement operator (using preincrement operator). More...
 
self operator-- (int)
 Postdecrement operator (using predecrement operator). More...
 
self operator+ (difference_type n) const
 Addition operator (iterator plus integer, using +=). More...
 
selfoperator-= (difference_type n)
 Subtraction/assignment operator (using +=). More...
 
self operator- (difference_type n) const
 Subtraction operator (using +=). More...
 
base () const
 Get the base iterator, inspired by std::reverse_iterator::base(). More...
 
difference_type operator- (const self &lhs, const self &rhs)
 Difference operator. More...
 
self operator+ (difference_type n, const self &it)
 Addition operator (integer plus iterator, using +=). More...
 

Detailed Description

template<typename I>
class apf::circular_iterator< I >

Circular iterator class.

Creates an iterator which can be infinitely iterated. When reaching the end of the range, it just starts again at the beginning. And vice versa.

Template Parameters
Ithe iterator type on which the circular iterator is based on. circular_iterator<I> has the same iterator_category as I itself. It only really works with random access iterators, however.

Definition at line 671 of file iterator.h.

Member Typedef Documentation

◆ iterator_category

template<typename I >
using apf::circular_iterator< I >::iterator_category = typename std::iterator_traits<I>::iterator_category

Definition at line 679 of file iterator.h.

◆ value_type

template<typename I >
using apf::circular_iterator< I >::value_type = typename std::iterator_traits<I>::value_type

Definition at line 681 of file iterator.h.

◆ difference_type

template<typename I >
using apf::circular_iterator< I >::difference_type = typename std::iterator_traits<I>::difference_type

Definition at line 682 of file iterator.h.

◆ pointer

template<typename I >
using apf::circular_iterator< I >::pointer = typename std::iterator_traits<I>::pointer

Definition at line 683 of file iterator.h.

◆ reference

template<typename I >
using apf::circular_iterator< I >::reference = typename std::iterator_traits<I>::reference

Definition at line 684 of file iterator.h.

Constructor & Destructor Documentation

◆ circular_iterator() [1/4]

template<typename I >
apf::circular_iterator< I >::circular_iterator ( begin,
end,
current 
)
inline

Constructor with explicit current iterator.

Parameters
beginbegin of the original iterator range
endend of said range
currentcurrent iterator within the range

Definition at line 695 of file iterator.h.

References apf::no_nullptr().

◆ circular_iterator() [2/4]

template<typename I >
apf::circular_iterator< I >::circular_iterator ( begin,
end 
)
inline

Constructor with implicit current iterator.

Parameters
beginbegin of the original iterator range
endend of said range
Note
The current iterator is set to begin.

Definition at line 709 of file iterator.h.

References apf::no_nullptr().

◆ circular_iterator() [3/4]

template<typename I >
apf::circular_iterator< I >::circular_iterator ( begin)
inlineexplicit

Constructor from one iterator.

Parameters
beginbegin of the original iterator range
Note
The resulting iterator is of limited use, because there is only one location where it will ever point to. Let's call it a stagnant iterator.

Definition at line 724 of file iterator.h.

References apf::no_nullptr().

◆ circular_iterator() [4/4]

template<typename I >
apf::circular_iterator< I >::circular_iterator ( )
inline

Default constructor.

Note
This constructor creates a singular iterator. Another circular_iterator can be assigned to it, but nothing else works.

Definition at line 736 of file iterator.h.

Member Function Documentation

◆ operator++() [1/2]

template<typename I >
self & apf::circular_iterator< I >::operator++ ( )
inline

Preincrement operator.

Definition at line 750 of file iterator.h.

References apf::no_nullptr().

◆ operator--() [1/2]

template<typename I >
self & apf::circular_iterator< I >::operator-- ( )
inline

Predecrement operator.

Definition at line 760 of file iterator.h.

References apf::no_nullptr().

◆ operator+=()

template<typename I >
self & apf::circular_iterator< I >::operator+= ( difference_type  n)
inline

Addition/assignment operator.

Definition at line 770 of file iterator.h.

References apf::no_nullptr(), and apf::math::wrap().

◆ operator*()

template<typename I >
reference apf::circular_iterator< I >::operator* ( ) const
inline

Straightforward dereference operator.

Definition at line 810 of file iterator.h.

◆ operator->()

template<typename I >
pointer apf::circular_iterator< I >::operator-> ( ) const
inline

Straightforward arrow operator.

Definition at line 811 of file iterator.h.

◆ operator==()

template<typename I >
bool apf::circular_iterator< I >::operator== ( const self rhs) const
inline

Straightforward equality operator.

Definition at line 812 of file iterator.h.

◆ operator!=()

template<typename I >
bool apf::circular_iterator< I >::operator!= ( const self rhs) const
inline

Unequality operator (using equality operator).

Definition at line 813 of file iterator.h.

◆ operator[]()

template<typename I >
reference apf::circular_iterator< I >::operator[] ( difference_type  n) const
inline

Straightforward subscript operator (using + and dereference op).

Definition at line 814 of file iterator.h.

◆ operator++() [2/2]

template<typename I >
self apf::circular_iterator< I >::operator++ ( int  )
inline

Postincrement operator (using preincrement operator).

Definition at line 815 of file iterator.h.

◆ operator--() [2/2]

template<typename I >
self apf::circular_iterator< I >::operator-- ( int  )
inline

Postdecrement operator (using predecrement operator).

Definition at line 816 of file iterator.h.

◆ operator+()

template<typename I >
self apf::circular_iterator< I >::operator+ ( difference_type  n) const
inline

Addition operator (iterator plus integer, using +=).

Definition at line 817 of file iterator.h.

◆ operator-=()

template<typename I >
self & apf::circular_iterator< I >::operator-= ( difference_type  n)
inline

Subtraction/assignment operator (using +=).

Definition at line 817 of file iterator.h.

◆ operator-()

template<typename I >
self apf::circular_iterator< I >::operator- ( difference_type  n) const
inline

Subtraction operator (using +=).

Definition at line 817 of file iterator.h.

◆ base()

template<typename I >
I apf::circular_iterator< I >::base ( ) const
inline

Get the base iterator, inspired by std::reverse_iterator::base().

Definition at line 821 of file iterator.h.

Friends And Related Function Documentation

◆ operator-

template<typename I >
difference_type operator- ( const self lhs,
const self rhs 
)
friend

Difference operator.

Note
Always returns a non-negative difference.
Warning
This operator only works when a and b are iterators for the same data (i.e. they were constructed with identical begin and end iterators)! This is not checked internally, you have to do that!
Parameters
lhsthe iterator to the left of the minus sign
rhsthe iterator on the right side

Definition at line 791 of file iterator.h.

◆ operator+

template<typename I >
self operator+ ( difference_type  n,
const self it 
)
friend

Addition operator (integer plus iterator, using +=).

Definition at line 817 of file iterator.h.


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