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
// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4
#
ifndef
TETL_TYPE_TRAITS_EXTENT_HPP
5
#
define
TETL_TYPE_TRAITS_EXTENT_HPP
6
7
#
include
<
etl
/
_cstddef
/
size_t
.
hpp
>
8
#
include
<
etl
/
_type_traits
/
integral_constant
.
hpp
>
9
10
namespace
etl
{
11
12
/// \brief If T is an array type, provides the member constant value equal to
13
/// the number of elements along the Nth dimension of the array, if N is in [0,
14
/// rank_v<T>). For any other type, or if T is an array of unknown bound along
15
/// its first dimension and N is 0, value is 0.
16
template
<
typename
T,
unsigned
N = 0>
17
struct
extent
:
integral_constant
<size_t, 0> { };
18
19
template
<
typename
T>
20
struct
extent
<T[], 0> :
integral_constant
<size_t, 0> { };
21
22
template
<
typename
T,
unsigned
N>
23
struct
extent
<T[], N> :
extent
<T, N - 1> { };
24
25
template
<
typename
T, size_t I>
26
struct
extent
<T[I], 0> :
integral_constant
<size_t, I> { };
27
28
template
<
typename
T, size_t I,
unsigned
N>
29
struct
extent
<T[I], N> :
extent
<T, N - 1> { };
30
31
template
<
typename
T
,
unsigned
N
= 0>
32
inline
constexpr
auto
extent_v
=
static_cast
<
size_t
>(
extent
<
T
,
N
>::
value
);
33
34
}
// namespace etl
35
36
#
endif
// TETL_TYPE_TRAITS_EXTENT_HPP
etl
Definition
adjacent_find.hpp:9
etl::extent_v
constexpr auto extent_v
Definition
extent.hpp:32
etl::extent
If T is an array type, provides the member constant value equal to the number of elements along the N...
Definition
extent.hpp:17
etl::integral_constant
Definition
integral_constant.hpp:10
include
etl
_type_traits
extent.hpp
Generated on Sun Sep 7 2025 19:15:17 for tetl by
1.9.8