tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches

Range iterators. More...

Concepts

concept  etl::legacy_bidirectional_iterator
 
concept  etl::legacy_forward_iterator
 
concept  etl::legacy_input_iterator
 
concept  etl::legacy_iterator
 
concept  etl::sentinel_for
 
concept  etl::weakly_incrementable
 

Classes

struct  back_insert_iterator< Container >
 etl::back_insert_iterator is a LegacyOutputIterator that appends to a container for which it was constructed. The container's push_back() member function is called whenever the iterator (whether dereferenced or not) is assigned to. Incrementing the etl::back_insert_iterator is a no-op. More...
 
struct  bidirectional_iterator_tag
 Defines the category of an iterator. Each tag is an empty type and corresponds to one of the five (until C++20) six (since C++20) iterator categories. More...
 
struct  contiguous_iterator_tag
 Defines the category of an iterator. Each tag is an empty type and corresponds to one of the five (until C++20) six (since C++20) iterator categories. More...
 
struct  forward_iterator_tag
 Defines the category of an iterator. Each tag is an empty type and corresponds to one of the five (until C++20) six (since C++20) iterator categories. More...
 
struct  front_insert_iterator< Container >
 front_insert_iterator is an LegacyOutputIterator that prepends elements to a container for which it was constructed. More...
 
struct  input_iterator_tag
 Defines the category of an iterator. Each tag is an empty type and corresponds to one of the five (until C++20) six (since C++20) iterator categories. More...
 
struct  output_iterator_tag
 Defines the category of an iterator. Each tag is an empty type and corresponds to one of the five (until C++20) six (since C++20) iterator categories. More...
 
struct  random_access_iterator_tag
 Defines the category of an iterator. Each tag is an empty type and corresponds to one of the five (until C++20) six (since C++20) iterator categories. More...
 
struct  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. More...
 

Typedefs

template<typename F, typename... Iters>
using indirect_result_t = etl::invoke_result_t<F, etl::iter_reference_t<Iters>...>
 
template<etl::indirectly_readable T>
using iter_common_reference_t = etl::common_reference_t<etl::iter_reference_t<T>, etl::iter_value_t<T>&>
 
template<typename T>
using iter_difference_t = typename detail::iter_difference<T>::type
 
template<etl::indirectly_readable Iter, etl::indirectly_regular_unary_invocable< Iter > Proj>
using projected = etl::detail::projected_impl<Iter, Proj>::type
 

Functions

template<typename It, typename Distance>
constexpr auto advance (It &it, Distance n) -> void
 Increments given iterator it by n elements.
 
template<typename C>
constexpr auto begin (C &c) -> decltype(c.begin())
 Returns an iterator to the beginning of the given container c or array array. These templates rely on C::begin() having a reasonable implementation. Returns exactly c.begin(), which is typically an iterator to the beginning of the sequence represented by c. If C is a standard Container, this returns C::iterator when c is not const-qualified, and C::const_iterator otherwise. Custom overloads of begin may be provided for classes that do not expose a suitable begin() member function, yet can be iterated.
 
template<typename C>
constexpr auto begin (C const &c) -> decltype(c.begin())
 
template<typename T, etl::size_t N>
constexpr auto begin (T(&array)[N]) noexcept -> T *
 
template<typename C>
constexpr auto cbegin (C const &c) noexcept(noexcept(begin(c))) -> decltype(begin(c))
 
template<typename C>
constexpr auto cend (C const &c) noexcept(noexcept(end(c))) -> decltype(end(c))
 
template<typename Container>
constexpr auto crbegin (Container const &c) -> decltype(rbegin(c))
 
template<typename Container>
constexpr auto crend (Container const &c) -> decltype(rend(c))
 Returns an iterator to the reverse-end of the given container.
 
template<typename C>
constexpr auto data (C &c) noexcept(noexcept(c.data())) -> decltype(c.data())
 Returns a pointer to the block of memory containing the elements of the container.
 
template<typename C>
constexpr auto data (C const &c) noexcept(noexcept(c.data())) -> decltype(c.data())
 
template<typename T, size_t N>
constexpr auto data (T(&array)[N]) noexcept -> T *
 
template<typename It>
constexpr auto distance (It first, It last) -> typename iterator_traits< It >::difference_type
 Returns the number of hops from first to last.
 
template<typename C>
constexpr auto empty (C const &c) noexcept(noexcept(c.empty())) -> decltype(c.empty())
 Returns whether the given container is empty.
 
template<typename T, size_t N>
constexpr auto empty (T(&array)[N]) noexcept -> bool
 Returns whether the given container is empty.
 
template<typename C>
constexpr auto end (C &c) -> decltype(c.end())
 Returns an iterator to the end (i.e. the element after the last element) of the given container c or array array. These templates rely on.
 
template<typename C>
constexpr auto end (C const &c) -> decltype(c.end())
 
template<typename T, etl::size_t N>
constexpr auto end (T(&array)[N]) noexcept -> T *
 
template<typename C>
constexpr auto full (C const &c) noexcept(noexcept(c.full())) -> decltype(c.full())
 Returns whether the given container is full.
 
template<typename T, size_t N>
constexpr auto full (T(&array)[N]) noexcept -> bool
 
template<typename InputIt>
constexpr auto next (InputIt it, typename iterator_traits< InputIt >::difference_type n=1) -> InputIt
 Return the nth successor of iterator it.
 
template<typename BidirIt>
constexpr auto prev (BidirIt it, typename iterator_traits< BidirIt >::difference_type n=1) -> BidirIt
 Return the nth predecessor of iterator it.
 
template<typename Container>
constexpr auto rbegin (Container &c) -> decltype(c.rbegin())
 Returns an iterator to the reverse-beginning of the given container.
 
template<typename Container>
constexpr auto rbegin (Container const &c) -> decltype(c.rbegin())
 
template<typename T, size_t N>
constexpr auto rbegin (T(&array)[N]) -> reverse_iterator< T * >
 
template<typename Container>
constexpr auto rend (Container &c) -> decltype(c.rend())
 Returns an iterator to the reverse-end of the given container.
 
template<typename Container>
constexpr auto rend (Container const &c) -> decltype(c.rend())
 
template<typename T, size_t N>
constexpr auto rend (T(&array)[N]) -> reverse_iterator< T * >
 
template<typename C>
constexpr auto size (C const &c) noexcept(noexcept(c.size())) -> decltype(c.size())
 Returns the size of the given container c or array array. Returns c.size(), converted to the return type if necessary.
 
template<typename T, size_t N>
constexpr auto size (T const (&array)[N]) noexcept -> size_t
 
template<typename C>
constexpr auto ssize (C const &c) -> common_type_t< ptrdiff_t, make_signed_t< decltype(c.size())> >
 
template<typename T, ptrdiff_t N>
constexpr auto ssize (T const (&array)[static_cast< size_t >(N)]) noexcept -> ptrdiff_t
 

Variables

constexpr auto iter_move = iter_move_cpo::fn{}
 

Detailed Description

Range iterators.

Typedef Documentation

◆ indirect_result_t

template<typename F, typename... Iters>
using indirect_result_t = etl::invoke_result_t<F, etl::iter_reference_t<Iters>...>

◆ iter_common_reference_t

◆ iter_difference_t

template<typename T>
using iter_difference_t = typename detail::iter_difference<T>::type

◆ projected

using projected = etl::detail::projected_impl<Iter, Proj>::type

Function Documentation

◆ advance()

template<typename It, typename Distance>
auto advance ( It & it,
Distance n ) -> void
constexpr

Increments given iterator it by n elements.

If n is negative, the iterator is decremented. In this case, InputIt must meet the requirements of LegacyBidirectionalIterator, otherwise the behavior is undefined.

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

◆ begin() [1/3]

template<typename C>
auto begin ( C & c) -> decltype(c.begin())
constexpr

Returns an iterator to the beginning of the given container c or array array. These templates rely on C::begin() having a reasonable implementation. Returns exactly c.begin(), which is typically an iterator to the beginning of the sequence represented by c. If C is a standard Container, this returns C::iterator when c is not const-qualified, and C::const_iterator otherwise. Custom overloads of begin may be provided for classes that do not expose a suitable begin() member function, yet can be iterated.

◆ begin() [2/3]

template<typename C>
auto begin ( C const & c) -> decltype(c.begin())
constexpr

◆ begin() [3/3]

template<typename T, etl::size_t N>
auto begin ( T(&) array[N]) -> T*
constexprnoexcept

◆ cbegin()

template<typename C>
auto cbegin ( C const & c) -> decltype(begin(c))
constexprnoexcept

◆ cend()

template<typename C>
auto cend ( C const & c) -> decltype(end(c))
constexprnoexcept

◆ crbegin()

template<typename Container>
auto crbegin ( Container const & c) -> decltype(rbegin(c))
constexpr

◆ crend()

template<typename Container>
auto crend ( Container const & c) -> decltype(rend(c))
constexpr

Returns an iterator to the reverse-end of the given container.

◆ data() [1/3]

template<typename C>
auto data ( C & c) -> decltype(c.data())
constexprnoexcept

Returns a pointer to the block of memory containing the elements of the container.

◆ data() [2/3]

template<typename C>
auto data ( C const & c) -> decltype(c.data())
constexprnoexcept

◆ data() [3/3]

template<typename T, size_t N>
auto data ( T(&) array[N]) -> T*
constexprnoexcept

◆ distance()

template<typename It>
auto distance ( It first,
It last ) -> typename iterator_traits<It>::difference_type
constexpr

Returns the number of hops from first to last.

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

◆ empty() [1/2]

template<typename C>
auto empty ( C const & c) -> decltype(c.empty())
constexprnoexcept

Returns whether the given container is empty.

◆ empty() [2/2]

template<typename T, size_t N>
auto empty ( T(&) array[N]) -> bool
constexprnoexcept

Returns whether the given container is empty.

◆ end() [1/3]

template<typename C>
auto end ( C & c) -> decltype(c.end())
constexpr

Returns an iterator to the end (i.e. the element after the last element) of the given container c or array array. These templates rely on.

◆ end() [2/3]

template<typename C>
auto end ( C const & c) -> decltype(c.end())
constexpr

◆ end() [3/3]

template<typename T, etl::size_t N>
auto end ( T(&) array[N]) -> T*
constexprnoexcept

◆ full() [1/2]

template<typename C>
auto full ( C const & c) -> decltype(c.full())
constexprnoexcept

Returns whether the given container is full.

◆ full() [2/2]

template<typename T, size_t N>
auto full ( T(&) array[N]) -> bool
constexprnoexcept

◆ next()

template<typename InputIt>
auto next ( InputIt it,
typename iterator_traits< InputIt >::difference_type n = 1 ) -> InputIt
nodiscardconstexpr

Return the nth successor of iterator it.

Examples
numeric.cpp.

◆ prev()

template<typename BidirIt>
auto prev ( BidirIt it,
typename iterator_traits< BidirIt >::difference_type n = 1 ) -> BidirIt
nodiscardconstexpr

Return the nth predecessor of iterator it.

◆ rbegin() [1/3]

template<typename Container>
auto rbegin ( Container & c) -> decltype(c.rbegin())
constexpr

Returns an iterator to the reverse-beginning of the given container.

◆ rbegin() [2/3]

template<typename Container>
auto rbegin ( Container const & c) -> decltype(c.rbegin())
constexpr

◆ rbegin() [3/3]

template<typename T, size_t N>
auto rbegin ( T(&) array[N]) -> reverse_iterator<T*>
constexpr

◆ rend() [1/3]

template<typename Container>
auto rend ( Container & c) -> decltype(c.rend())
constexpr

Returns an iterator to the reverse-end of the given container.

◆ rend() [2/3]

template<typename Container>
auto rend ( Container const & c) -> decltype(c.rend())
constexpr

◆ rend() [3/3]

template<typename T, size_t N>
auto rend ( T(&) array[N]) -> reverse_iterator<T*>
constexpr

◆ size() [1/2]

template<typename C>
auto size ( C const & c) -> decltype(c.size())
constexprnoexcept

Returns the size of the given container c or array array. Returns c.size(), converted to the return type if necessary.

Examples
numeric.cpp.

◆ size() [2/2]

template<typename T, size_t N>
auto size ( T const (&) array[N]) -> size_t
constexprnoexcept

◆ ssize() [1/2]

template<typename C>
auto ssize ( C const & c) -> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>
constexpr

◆ ssize() [2/2]

template<typename T, ptrdiff_t N>
auto ssize ( T const (&) array[static_cast< size_t >(N)]) -> ptrdiff_t
constexprnoexcept

Variable Documentation

◆ iter_move

auto iter_move = iter_move_cpo::fn{}
inlineconstexpr