15 #ifndef OPENSCENARIO_INTERPRETER__ITERATOR__CIRCULAR_ITERATOR_HPP_
16 #define OPENSCENARIO_INTERPRETER__ITERATOR__CIRCULAR_ITERATOR_HPP_
19 #include <type_traits>
23 inline namespace iterator
25 template <
typename Container>
28 using ForwardIterator =
typename Container::iterator;
29 using ForwardConstIterator =
typename Container::const_iterator;
31 const ForwardIterator begin, end;
32 ForwardIterator current;
37 using value_type =
typename std::iterator_traits<ForwardIterator>::value_type;
39 using reference =
typename std::add_lvalue_reference<value_type>::type;
43 using pointer =
typename std::iterator_traits<ForwardIterator>::pointer;
45 using difference_type =
typename std::iterator_traits<ForwardIterator>::difference_type;
47 explicit CircularIterator(ForwardIterator begin, ForwardIterator end, ForwardIterator current)
48 : begin(begin), end(end), current(current)
58 operator ForwardConstIterator()
const {
return current; }
59 operator ForwardIterator() {
return current; }
67 }
else if (++current == end) {
Definition: circular_iterator.hpp:27
typename std::iterator_traits< ForwardIterator >::value_type value_type
Definition: circular_iterator.hpp:37
auto operator++(int)
Definition: circular_iterator.hpp:74
std::forward_iterator_tag iterator_category
Definition: circular_iterator.hpp:35
auto & operator++()
Definition: circular_iterator.hpp:63
typename std::add_lvalue_reference< value_type >::type reference
Definition: circular_iterator.hpp:39
reference operator*() const
Definition: circular_iterator.hpp:61
typename std::iterator_traits< ForwardIterator >::pointer pointer
Definition: circular_iterator.hpp:43
CircularIterator(ForwardIterator begin, ForwardIterator end, ForwardIterator current)
Definition: circular_iterator.hpp:47
CircularIterator & operator=(const ForwardIterator &iterator)
Definition: circular_iterator.hpp:52
typename std::iterator_traits< ForwardIterator >::difference_type difference_type
Definition: circular_iterator.hpp:45
typename std::add_const< reference >::type const_reference
Definition: circular_iterator.hpp:41