tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
end.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2020 Tobias Hienzsch
3
4#ifndef TETL_ITERATOR_END_HPP
5#define TETL_ITERATOR_END_HPP
6
7#include <etl/_cstddef/size_t.hpp>
8
9namespace etl {
10
11/// \brief Returns an iterator to the end (i.e. the element after the last
12/// element) of the given container c or array array. These templates rely on
13/// \ingroup iterator
14template <typename C>
15constexpr auto end(C& c) -> decltype(c.end())
16{
17 return c.end();
18}
19
20/// \ingroup iterator
21template <typename C>
22constexpr auto end(C const& c) -> decltype(c.end())
23{
24 return c.end();
25}
26
27/// \ingroup iterator
28template <typename T, etl::size_t N>
29constexpr auto end(T (&array)[N]) noexcept -> T*
30{
31 return &array[N];
32}
33
34/// \ingroup iterator
35template <typename C>
36constexpr auto cend(C const& c) noexcept(noexcept(end(c))) -> decltype(end(c))
37{
38 return end(c);
39}
40
41} // namespace etl
42
43#endif // TETL_ITERATOR_END_HPP
constexpr auto end(C const &c) -> decltype(c.end())
Definition end.hpp:22
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 ...
Definition end.hpp:15
constexpr auto cend(C const &c) noexcept(noexcept(end(c))) -> decltype(end(c))
Definition end.hpp:36
constexpr auto end(T(&array)[N]) noexcept -> T *
Definition end.hpp:29
Definition adjacent_find.hpp:9