ape  0.5.0
Audio Programming Environment
Public Types | Public Member Functions | Friends | List of all members
ape::circular_iterator< T > Struct Template Reference

LegacyForwardIterator with capability of iterating N steps around a flat source with an offset. In other words, if exceeding the "end" of any referenced container, it will wrap around and start from the beginning again.

See also
cyclic_begin, cyclic_end
More...

#include <misc.h>

Public Types

using value_type = T
 
using difference_type = std::ptrdiff_t
 
using reference = value_type &
 
using pointer = T *
 
using iterator_category = std::forward_iterator_tag
 
using this_type = circular_iterator< T >
 

Public Member Functions

reference operator* () noexcept
 
this_type operator++ (int) noexcept
 
this_typeoperator++ () noexcept
 
pointer operator-> () noexcept
 
this_type operator-- (int) noexcept
 
this_typeoperator-- () noexcept
 

Friends

template<typename Container >
auto cyclic_begin (Container &c, std::size_t offset)
 Constructs a suitable beginning iterator of a cyclic iteration on c . Iteration effectively wraps around, until it compares equal to something returned by cyclic_end. More...
 
template<typename Container >
auto cyclic_end (Container &c, std::size_t offset, std::size_t length)
 Specifies an "end" to cyclic_begin More...
 
bool operator== (circular_iterator< T > left, circular_iterator< T > right)
 
bool operator!= (circular_iterator< T > left, circular_iterator< T > right)
 

Detailed Description

template<typename T>
struct ape::circular_iterator< T >

LegacyForwardIterator with capability of iterating N steps around a flat source with an offset. In other words, if exceeding the "end" of any referenced container, it will wrap around and start from the beginning again.

See also
cyclic_begin, cyclic_end

Member Typedef Documentation

◆ difference_type

template<typename T>
using ape::circular_iterator< T >::difference_type = std::ptrdiff_t

◆ iterator_category

template<typename T>
using ape::circular_iterator< T >::iterator_category = std::forward_iterator_tag

◆ pointer

template<typename T>
using ape::circular_iterator< T >::pointer = T*

◆ reference

template<typename T>
using ape::circular_iterator< T >::reference = value_type&

◆ this_type

template<typename T>
using ape::circular_iterator< T >::this_type = circular_iterator<T>

◆ value_type

template<typename T>
using ape::circular_iterator< T >::value_type = T

Member Function Documentation

◆ operator*()

template<typename T>
reference ape::circular_iterator< T >::operator* ( )
inlinenoexcept

◆ operator++() [1/2]

template<typename T>
this_type& ape::circular_iterator< T >::operator++ ( )
inlinenoexcept

◆ operator++() [2/2]

template<typename T>
this_type ape::circular_iterator< T >::operator++ ( int  )
inlinenoexcept

◆ operator--() [1/2]

template<typename T>
this_type& ape::circular_iterator< T >::operator-- ( )
inlinenoexcept

◆ operator--() [2/2]

template<typename T>
this_type ape::circular_iterator< T >::operator-- ( int  )
inlinenoexcept

◆ operator->()

template<typename T>
pointer ape::circular_iterator< T >::operator-> ( )
inlinenoexcept

Friends And Related Function Documentation

◆ cyclic_begin

template<typename T>
template<typename Container >
auto cyclic_begin ( Container &  c,
std::size_t  offset 
)
friend

Constructs a suitable beginning iterator of a cyclic iteration on c . Iteration effectively wraps around, until it compares equal to something returned by cyclic_end.

Parameters
cAny "container" supporting size() and data()
offsetWhere to start in c .

◆ cyclic_end

template<typename T>
template<typename Container >
auto cyclic_end ( Container &  c,
std::size_t  offset,
std::size_t  length 
)
friend

Specifies an "end" to cyclic_begin

Parameters
cAny "container" supporting size() and data()
offsetWhere to start in c . Must match the parameter given to cyclic_begin!
lengthHow many iterations to be performed before the pair compares equal.

◆ operator!=

template<typename T>
bool operator!= ( circular_iterator< T >  left,
circular_iterator< T >  right 
)
friend

◆ operator==

template<typename T>
bool operator== ( circular_iterator< T >  left,
circular_iterator< T >  right 
)
friend

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