|
5.0.0
Freundlich's C++ toolkit
|
An iterator adaptor that cycles through a range.
| ContainerIterator | The underlying iterator which must be at least a forward iterator |
A cyclic iterator can be useful in cases where you want end() to become begin() again. For example, imagine a cycling through a list of items which means if you skip over the last, you will return to the first one.
Here is a short example demonstrating its use.
Public Types | |
| using | base_type = fcppt::detail::cyclic_iterator_base<ContainerIterator> |
| using | container_iterator_type = ContainerIterator |
| using | value_type = typename base_type::value_type |
| using | reference = typename base_type::reference |
| using | pointer = typename base_type::pointer |
| using | difference_type = typename base_type::difference_type |
| using | iterator_category = typename base_type::iterator_category |
| using | boundary = fcppt::tuple::object<container_iterator_type, container_iterator_type> |
Public Member Functions | |
| cyclic_iterator () | |
| template<typename OtherIterator> | |
| cyclic_iterator (cyclic_iterator< OtherIterator > const &other) | |
| Copy constructs from another cyclic iterator. | |
| cyclic_iterator (container_iterator_type const &pos, boundary) | |
| Constructs a new cyclic iterator. | |
| template<typename OtherIterator> | |
| cyclic_iterator & | operator= (cyclic_iterator< OtherIterator > const &other) |
| Assigns from another cyclic iterator. | |
| boundary const & | get_boundary () const |
| Returns the boundary. | |
| container_iterator_type | get () const |
| Returns the underlying iterator. | |
| void | advance (difference_type) |
| void | increment () |
| void | decrement () |
| bool | equal (cyclic_iterator const &) const |
| reference | dereference () const |
| difference_type | distance_to (cyclic_iterator const &) const |
| using fcppt::cyclic_iterator< ContainerIterator >::base_type = fcppt::detail::cyclic_iterator_base<ContainerIterator> |
| using fcppt::cyclic_iterator< ContainerIterator >::boundary = fcppt::tuple::object<container_iterator_type, container_iterator_type> |
| using fcppt::cyclic_iterator< ContainerIterator >::container_iterator_type = ContainerIterator |
| using fcppt::cyclic_iterator< ContainerIterator >::difference_type = typename base_type::difference_type |
| using fcppt::cyclic_iterator< ContainerIterator >::iterator_category = typename base_type::iterator_category |
| using fcppt::cyclic_iterator< ContainerIterator >::pointer = typename base_type::pointer |
| using fcppt::cyclic_iterator< ContainerIterator >::reference = typename base_type::reference |
| using fcppt::cyclic_iterator< ContainerIterator >::value_type = typename base_type::value_type |
| fcppt::cyclic_iterator< ContainerIterator >::cyclic_iterator | ( | ) |
|
explicit |
Copy constructs from another cyclic iterator.
Copy constructs from another cyclic iterator other. This only works if the underlying iterators are convertible.
| other | The iterator to copy construct from |
| fcppt::cyclic_iterator< ContainerIterator >::cyclic_iterator | ( | container_iterator_type const & | pos, |
| boundary | ) |
Constructs a new cyclic iterator.
Constructs a new cyclic iterator, starting at it, inside a range of boundary.
| void fcppt::cyclic_iterator< ContainerIterator >::advance | ( | difference_type | ) |
| void fcppt::cyclic_iterator< ContainerIterator >::decrement | ( | ) |
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscard |
Returns the underlying iterator.
|
nodiscard |
Returns the boundary.
| void fcppt::cyclic_iterator< ContainerIterator >::increment | ( | ) |
| cyclic_iterator & fcppt::cyclic_iterator< ContainerIterator >::operator= | ( | cyclic_iterator< OtherIterator > const & | other | ) |
Assigns from another cyclic iterator.
Assigns from another cyclic iterator other. This only works if the underlying iterators are convertible.
| other | The iterator to assign from |
*this