tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
extent.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_TYPE_TRAITS_EXTENT_HPP
4#define TETL_TYPE_TRAITS_EXTENT_HPP
5
8
9namespace etl {
10
15template <typename T, unsigned N = 0>
16struct extent : integral_constant<size_t, 0> { };
17
18template <typename T>
19struct extent<T[], 0> : integral_constant<size_t, 0> { };
20
21template <typename T, unsigned N>
22struct extent<T[], N> : extent<T, N - 1> { };
23
24template <typename T, size_t I>
25struct extent<T[I], 0> : integral_constant<size_t, I> { };
26
27template <typename T, size_t I, unsigned N>
28struct extent<T[I], N> : extent<T, N - 1> { };
29
30template <typename T, unsigned N = 0>
31inline constexpr auto extent_v = static_cast<size_t>(extent<T, N>::value);
32
33} // namespace etl
34
35#endif // TETL_TYPE_TRAITS_EXTENT_HPP
Definition adjacent_find.hpp:8
constexpr auto extent_v
Definition extent.hpp:31
If T is an array type, provides the member constant value equal to the number of elements along the N...
Definition extent.hpp:16
Definition integral_constant.hpp:9
static constexpr size_t value
Definition integral_constant.hpp:10