1 #ifndef AIMS_UTILITY_CYCLIC_ITERATOR_H_
2 #define AIMS_UTILITY_CYCLIC_ITERATOR_H_
12 template <
typename TContainer,
typename TIterator >
15 if (++i == c.end()) i = c.begin();
37 template <
typename TIterator >
49 template <
typename TContainer >
52 template <
typename TContainer >
53 cyclic_iterator_base(TContainer &c,
const TIterator & i) : m_iterator(i), m_begin(c.begin()), m_end(c.end())
58 if (m_iterator == m_end) m_iterator = m_begin;
65 typename std::iterator_traits<TIterator>::reference
68 const typename std::iterator_traits<TIterator>::reference
74 if (m_iterator == m_end) m_iterator = m_begin;
79 if (m_iterator == m_begin) m_iterator = m_end;
88 return m_iterator != i;
112 template <
typename TContainer >
128 template <
typename TContainer >
A const cyclic iterator is a const iterator that goes back to the begining of the container when it r...
const_cyclic_iterator(const TContainer &c, const typename TContainer::const_iterator &i)
detail::cyclic_iterator_base< typename TContainer::const_iterator > Base
const_cyclic_iterator(const TContainer &c)
A cyclic iterator is an iterator that goes back to the begining of the container when it reaches the ...
cyclic_iterator(TContainer &c)
cyclic_iterator(TContainer &c, const typename TContainer::iterator &i)
detail::cyclic_iterator_base< typename TContainer::iterator > Base
TODO: when implementing the operator+=, it might be that we need to split the class in different part...
bool operator!=(const TIterator &i)
cyclic_iterator_base(TContainer &c, const TIterator &i)
NB: it is assumed that i does point on one of the element of c (end() accepted)
const std::iterator_traits< TIterator >::reference operator*() const
std::iterator_traits< TIterator >::reference operator*()
cyclic_iterator_base(TContainer &c)
The class for EcatSino data write operation.
TIterator cyclic_advance(TIterator i, TContainer &c)