tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
rend.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ITERATOR_REND_HPP
4#define TETL_ITERATOR_REND_HPP
5
7
8namespace etl {
9
10template <typename Iter>
11struct reverse_iterator;
12
15template <typename Container>
16constexpr auto rend(Container& c) -> decltype(c.rend())
17{
18 return c.rend();
19}
20
22template <typename Container>
23constexpr auto rend(Container const& c) -> decltype(c.rend())
24{
25 return c.rend();
26}
27
29template <typename T, size_t N>
30constexpr auto rend(T (&array)[N]) -> reverse_iterator<T*>
31{
33}
34
37template <typename Container>
38constexpr auto crend(Container const& c) -> decltype(rend(c))
39{
40 return rend(c);
41}
42
43} // namespace etl
44
45#endif // TETL_ITERATOR_REND_HPP
constexpr auto rend(Container &c) -> decltype(c.rend())
Returns an iterator to the reverse-end of the given container.
Definition rend.hpp:16
constexpr auto crend(Container const &c) -> decltype(rend(c))
Returns an iterator to the reverse-end of the given container.
Definition rend.hpp:38
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...
Definition begin.hpp:20
Definition adjacent_find.hpp:8
A container that encapsulates fixed size arrays.
Definition array.hpp:48
reverse_iterator is an iterator adaptor that reverses the direction of a given iterator....
Definition reverse_iterator.hpp:22