tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
begin.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ITERATOR_BEGIN_HPP
4#define TETL_ITERATOR_BEGIN_HPP
5
7
8namespace etl {
9
19template <typename C>
20constexpr auto begin(C& c) -> decltype(c.begin())
21{
22 return c.begin();
23}
24
26template <typename C>
27constexpr auto begin(C const& c) -> decltype(c.begin())
28{
29 return c.begin();
30}
31
33template <typename T, etl::size_t N>
34constexpr auto begin(T (&array)[N]) noexcept -> T*
35{
36 return &array[0];
37}
38
40template <typename C>
41constexpr auto cbegin(C const& c) noexcept(noexcept(begin(c))) -> decltype(begin(c))
42{
43 return begin(c);
44}
45
46} // namespace etl
47
48#endif // TETL_ITERATOR_BEGIN_HPP
constexpr auto cbegin(C const &c) noexcept(noexcept(begin(c))) -> decltype(begin(c))
Definition begin.hpp:41
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