31#ifndef ETL_CIRCULAR_ITERATOR_INCLUDED
32#define ETL_CIRCULAR_ITERATOR_INCLUDED
36#include "static_assert.h"
42 namespace private_circular_iterator
47 template <
typename TIterator>
49 :
public etl::iterator<typename etl::iterator_traits<TIterator>::iterator_category, typename etl::iterator_traits<TIterator>::value_type>
53 typedef typename etl::iterator_traits<TIterator>::value_type value_type;
54 typedef typename etl::iterator_traits<TIterator>::difference_type difference_type;
55 typedef typename etl::iterator_traits<TIterator>::pointer pointer;
56 typedef typename etl::iterator_traits<TIterator>::reference reference;
57 typedef typename etl::iterator_traits<TIterator>::iterator_category iterator_category;
120 ETL_CONSTEXPR14
size_t size()
const
205 template <
typename TIterator>
215 using common_t::operator=;
217 typedef typename common_t::value_type value_type;
218 typedef typename common_t::difference_type difference_type;
219 typedef typename common_t::pointer pointer;
220 typedef typename common_t::reference reference;
221 typedef typename common_t::iterator_category iterator_category;
260 common_t::operator=(
other);
270 if (++this->itr == this->itr_end)
272 this->itr = this->itr_begin;
296 template <
typename TIterator>
306 using common_t::operator=;
308 typedef typename common_t::value_type value_type;
309 typedef typename common_t::difference_type difference_type;
310 typedef typename common_t::pointer pointer;
311 typedef typename common_t::reference reference;
312 typedef typename common_t::iterator_category iterator_category;
351 common_t::operator=(
other);
361 if (++this->itr == this->itr_end)
363 this->itr = this->itr_begin;
386 if (this->itr == this->itr_begin)
390 this->itr =
ritr.base();
418 template <
typename TIterator>
428 using common_t::operator=;
430 typedef typename common_t::value_type value_type;
431 typedef typename common_t::difference_type difference_type;
432 typedef typename common_t::pointer pointer;
433 typedef typename common_t::reference reference;
434 typedef typename common_t::iterator_category iterator_category;
473 common_t::operator=(
other);
483 if (++this->itr == this->itr_end)
485 this->itr = this->itr_begin;
508 if (this->itr == this->itr_begin)
512 this->itr =
ritr.base();
539 const difference_type length = difference_type(this->
size());
545 const difference_type
distance_to_end = etl::distance(this->itr, this->itr_end);
569 offset = length - offset;
573 this->itr = this->itr_begin + offset;
594 template <
typename TIterator>
604 using impl_t::operator=;
606 typedef typename impl_t::value_type value_type;
607 typedef typename impl_t::difference_type difference_type;
608 typedef typename impl_t::pointer pointer;
609 typedef typename impl_t::reference reference;
610 typedef typename impl_t::iterator_category iterator_category;
649 impl_t::operator=(
other);
658 template <
typename TIterator>
660 typename etl::iterator_traits<TIterator>::difference_type offset)
671 template <
typename TIterator>
673 typename etl::iterator_traits<TIterator>::difference_type offset)
684 template <
typename TIterator>
694 template <
typename TIterator>
704 template <
typename TIterator>
714 template <
typename TIterator>
725 template <
typename TIterator>
735 template <
typename TIterator>
745 template <
typename TIterator>
Common circular iterator implementation.
Definition circular_iterator.h:50
ETL_CONSTEXPR14 TIterator current() const
Conversion to base iterator type.
Definition circular_iterator.h:176
ETL_CONSTEXPR14 value_type operator*()
Dereference operator.
Definition circular_iterator.h:136
TIterator itr_end
The underlying end iterator.
Definition circular_iterator.h:184
ETL_CONSTEXPR14 bool empty() const
Is there nothing to iterate over?
Definition circular_iterator.h:128
ETL_CONSTEXPR14 TIterator operator->()
-> operator.
Definition circular_iterator.h:152
ETL_CONSTEXPR14 circular_iterator_common(const circular_iterator_common &other)
Copy constructor.
Definition circular_iterator.h:82
ETL_CONSTEXPR14 circular_iterator_common()
Default constructor.
Definition circular_iterator.h:62
ETL_CONSTEXPR14 TIterator begin() const
Beginning of the range.
Definition circular_iterator.h:104
ETL_CONSTEXPR14 circular_iterator_common(TIterator itr_begin_, TIterator itr_end_, TIterator start_)
Construct from iterators.
Definition circular_iterator.h:72
TIterator itr_begin
The underlying begin iterator.
Definition circular_iterator.h:183
ETL_CONSTEXPR14 TIterator end() const
End of the range.
Definition circular_iterator.h:112
ETL_CONSTEXPR14 size_t size() const
How long is the range?
Definition circular_iterator.h:120
TIterator itr
The underlying iterator.
Definition circular_iterator.h:185
ETL_CONSTEXPR14 circular_iterator_common & operator=(const circular_iterator_common &other)
Assignment.
Definition circular_iterator.h:92
ETL_CONSTEXPR14 circular_iterator_impl(const circular_iterator_impl &other)
Copy constructor.
Definition circular_iterator.h:463
ETL_CONSTEXPR14 circular_iterator()
Default constructor.
Definition circular_iterator.h:615
ETL_CONSTEXPR14 circular_iterator_impl(TIterator itr_begin_, TIterator itr_end_, TIterator start_)
Construct from start + iterators.
Definition circular_iterator.h:333
ETL_CONSTEXPR14 circular_iterator_impl(const circular_iterator_impl &other)
Copy constructor.
Definition circular_iterator.h:341
ETL_CONSTEXPR14 circular_iterator_impl(TIterator itr_begin_, TIterator itr_end_, TIterator start_)
Construct from start + iterators.
Definition circular_iterator.h:242
ETL_CONSTEXPR14 circular_iterator(const circular_iterator &other)
Copy constructor.
Definition circular_iterator.h:639
ETL_CONSTEXPR14 circular_iterator_impl(TIterator itr_begin_, TIterator itr_end_, TIterator start_)
Construct from start + iterators.
Definition circular_iterator.h:455
ETL_CONSTEXPR14 circular_iterator(TIterator itr_begin_, TIterator itr_end_)
Construct from iterators.
Definition circular_iterator.h:623
ETL_CONSTEXPR14 circular_iterator_impl(const circular_iterator_impl &other)
Copy constructor.
Definition circular_iterator.h:250
ETL_CONSTEXPR14 circular_iterator_impl()
Default constructor.
Definition circular_iterator.h:317
ETL_CONSTEXPR14 circular_iterator_impl()
Default constructor.
Definition circular_iterator.h:226
ETL_CONSTEXPR14 circular_iterator_impl(TIterator itr_begin_, TIterator itr_end_)
Construct from iterators.
Definition circular_iterator.h:234
ETL_CONSTEXPR14 circular_iterator_impl(TIterator itr_begin_, TIterator itr_end_)
Construct from iterators.
Definition circular_iterator.h:325
ETL_CONSTEXPR14 circular_iterator_impl(TIterator itr_begin_, TIterator itr_end_)
Construct from iterators.
Definition circular_iterator.h:447
ETL_CONSTEXPR14 circular_iterator(TIterator itr_begin_, TIterator itr_end_, TIterator start_)
Construct from start + iterators.
Definition circular_iterator.h:631
ETL_CONSTEXPR14 circular_iterator_impl()
Default constructor.
Definition circular_iterator.h:439
Definition circular_iterator.h:597
Definition circular_iterator.h:195
is_same
Definition type_traits_generator.h:1041
bitset_ext
Definition absolute.h:38
ETL_CONSTEXPR14 etl::circular_iterator< TIterator > operator-(etl::circular_iterator< TIterator > &lhs, typename etl::iterator_traits< TIterator >::difference_type offset)
Definition circular_iterator.h:672
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:654
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1187
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:642
ETL_CONSTEXPR14 etl::circular_iterator< TIterator > operator+(etl::circular_iterator< TIterator > &lhs, typename etl::iterator_traits< TIterator >::difference_type offset)
Definition circular_iterator.h:659
iterator
Definition iterator.h:399
pair holds two objects of arbitrary type
Definition utility.h:164