tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
data.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_ITERATOR_DATA_HPP
5#define TETL_ITERATOR_DATA_HPP
6
7namespace etl {
8
9/// Returns a pointer to the block of memory containing the elements of the container.
10/// \ingroup iterator
11template <typename C>
12constexpr auto data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data())
13{
14 return c.data();
15}
16
17/// \ingroup iterator
18template <typename C>
19constexpr auto data(C const& c) noexcept(noexcept(c.data())) -> decltype(c.data())
20{
21 return c.data();
22}
23
24/// \ingroup iterator
25template <typename T, size_t N>
26constexpr auto data(T (&array)[N]) noexcept -> T*
27{
28 return &array[0];
29}
30
31} // namespace etl
32
33#endif // TETL_ITERATOR_DATA_HPP
constexpr auto data(C const &c) noexcept(noexcept(c.data())) -> decltype(c.data())
Definition data.hpp:19
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.
Definition data.hpp:12
constexpr auto data(T(&array)[N]) noexcept -> T *
Definition data.hpp:26
Definition adjacent_find.hpp:9