15 #ifndef PAAL_CYCLE_ITERATOR_HPP
16 #define PAAL_CYCLE_ITERATOR_HPP
20 #include <boost/iterator/iterator_facade.hpp>
23 namespace data_structures {
47 template <
typename Iter>
49 cycle_iterator<Iter>, typename std::iterator_traits<Iter>::value_type,
50 typename boost::forward_traversal_tag,
51 typename std::iterator_traits<Iter>::reference,
52 typename std::iterator_traits<Iter>::difference_type> {
54 typedef std::iterator_traits<Iter> IT;
55 typedef typename IT::reference ref;
67 : m_curr(start), m_start(start), m_begin(begin), m_end(end),
76 friend class boost::iterator_core_access;
84 if (m_curr == m_end) {
88 if (m_curr == m_start) {
95 return (m_is_end && ei.m_is_end) || m_curr == ei.m_curr;
98 ref dereference()
const {
return *m_curr; }
104 bool m_is_end =
false;
108 #endif // PAAL_CYCLE_ITERATOR_HPP
cycle_iterator(Iter start, Iter begin, Iter end)
constructing of cycle_iterator
For given collection (begin -> end) and start iterator pointing to an element inside collection (begi...
cycle_iterator()
Points to end of the collection.