tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
reverse_iterator< Iter > Struct Template Reference

reverse_iterator is an iterator adaptor that reverses the direction of a given iterator. In other words, when provided with a bidirectional iterator, reverse_iterator produces a new iterator that moves from the end to the beginning of the sequence defined by the underlying bidirectional iterator. This is the iterator returned by member functions rbegin() and rend() of the standard library containers. More...

#include <reverse_iterator.hpp>

Public Types

using difference_type = typename etl::iterator_traits< Iter >::difference_type
 
using iterator_category = typename etl::iterator_traits< Iter >::iterator_category
 
using iterator_type = Iter
 
using pointer = typename etl::iterator_traits< Iter >::pointer
 
using reference = typename etl::iterator_traits< Iter >::reference
 
using value_type = typename iterator_traits< Iter >::value_type
 

Public Member Functions

constexpr reverse_iterator ()
 Constructs a new iterator adaptor.
 
constexpr reverse_iterator (Iter x)
 Constructs a new iterator adaptor.
 
template<typename Other >
constexpr reverse_iterator (reverse_iterator< Other > const &other)
 Constructs a new iterator adaptor.
 
constexpr auto base () const -> Iter
 Returns the underlying base iterator.
 
constexpr auto operator* () const -> reference
 Returns a reference to the element previous to current.
 
constexpr auto operator+ (difference_type n) const -> reverse_iterator
 Returns an iterator which is advanced by n positions.
 
constexpr auto operator++ () -> reverse_iterator &
 Pre-increments by one respectively.
 
constexpr auto operator++ (int) -> reverse_iterator
 Pre-increments by one respectively.
 
constexpr auto operator+= (difference_type n) -> reverse_iterator &
 Advances the iterator by n or -n positions respectively.
 
constexpr auto operator- (difference_type n) const -> reverse_iterator
 Returns an iterator which is advanced by -n positions.
 
constexpr auto operator-- () -> reverse_iterator &
 Pre-decrements by one respectively.
 
constexpr auto operator-- (int) -> reverse_iterator
 Pre-decrements by one respectively.
 
constexpr auto operator-= (difference_type n) -> reverse_iterator &
 Advances the iterator by n or -n positions respectively.
 
constexpr auto operator-> () const -> pointer
 Returns a pointer to the element previous to current.
 
template<typename Other >
constexpr auto operator= (reverse_iterator< Other > const &other) -> reverse_iterator &
 The underlying iterator is assigned the value of the underlying iterator of other, i.e. other.base().
 
constexpr auto operator[] (difference_type n) const -> reference
 Returns a reference to the element at specified relative location.
 

Detailed Description

template<typename Iter>
struct etl::reverse_iterator< Iter >

reverse_iterator is an iterator adaptor that reverses the direction of a given iterator. In other words, when provided with a bidirectional iterator, reverse_iterator produces a new iterator that moves from the end to the beginning of the sequence defined by the underlying bidirectional iterator. This is the iterator returned by member functions rbegin() and rend() of the standard library containers.

https://en.cppreference.com/w/cpp/iterator/reverse_iterator

Member Typedef Documentation

◆ difference_type

◆ iterator_category

◆ iterator_type

◆ pointer

◆ reference

◆ value_type

Constructor & Destructor Documentation

◆ reverse_iterator() [1/3]

template<typename Iter >
constexpr reverse_iterator ( )
inlineconstexpr

Constructs a new iterator adaptor.

Default constructor. The underlying iterator is value-initialized. Operations on the resulting iterator have defined behavior if and only if the corresponding operations on a value-initialized Iterator also have defined behavior.

◆ reverse_iterator() [2/3]

template<typename Iter >
constexpr reverse_iterator ( Iter  x)
inlineexplicitconstexpr

Constructs a new iterator adaptor.

The underlying iterator is initialized with x.

◆ reverse_iterator() [3/3]

template<typename Iter >
template<typename Other >
constexpr reverse_iterator ( reverse_iterator< Other > const other)
inlineconstexpr

Constructs a new iterator adaptor.

The underlying iterator is initialized with that of other.

Member Function Documentation

◆ base()

template<typename Iter >
constexpr auto base ( ) const -> Iter
inlineconstexpr

Returns the underlying base iterator.

◆ operator*()

template<typename Iter >
constexpr auto operator* ( ) const -> reference
inlineconstexpr

Returns a reference to the element previous to current.

◆ operator+()

template<typename Iter >
constexpr auto operator+ ( difference_type  n) const -> reverse_iterator
inlineconstexpr

Returns an iterator which is advanced by n positions.

◆ operator++() [1/2]

template<typename Iter >
constexpr auto operator++ ( ) -> reverse_iterator&
inlineconstexpr

Pre-increments by one respectively.

◆ operator++() [2/2]

template<typename Iter >
constexpr auto operator++ ( int  ) -> reverse_iterator
inlineconstexpr

Pre-increments by one respectively.

◆ operator+=()

template<typename Iter >
constexpr auto operator+= ( difference_type  n) -> reverse_iterator&
inlineconstexpr

Advances the iterator by n or -n positions respectively.

◆ operator-()

template<typename Iter >
constexpr auto operator- ( difference_type  n) const -> reverse_iterator
inlineconstexpr

Returns an iterator which is advanced by -n positions.

◆ operator--() [1/2]

template<typename Iter >
constexpr auto operator-- ( ) -> reverse_iterator&
inlineconstexpr

Pre-decrements by one respectively.

◆ operator--() [2/2]

template<typename Iter >
constexpr auto operator-- ( int  ) -> reverse_iterator
inlineconstexpr

Pre-decrements by one respectively.

◆ operator-=()

template<typename Iter >
constexpr auto operator-= ( difference_type  n) -> reverse_iterator&
inlineconstexpr

Advances the iterator by n or -n positions respectively.

◆ operator->()

template<typename Iter >
constexpr auto operator-> ( ) const -> pointer
inlineconstexpr

Returns a pointer to the element previous to current.

◆ operator=()

template<typename Iter >
template<typename Other >
constexpr auto operator= ( reverse_iterator< Other > const other) -> reverse_iterator&
inlineconstexpr

The underlying iterator is assigned the value of the underlying iterator of other, i.e. other.base().

◆ operator[]()

template<typename Iter >
constexpr auto operator[] ( difference_type  n) const -> reference
inlineconstexpr

Returns a reference to the element at specified relative location.


The documentation for this struct was generated from the following files: