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
/// \ingroup type_traits
17
template
<
typename
T,
unsigned
N = 0>
18
struct
extent
:
integral_constant
<size_t, 0> { };
19
20
template
<
typename
T>
21
struct
extent
<T[], 0> :
integral_constant
<size_t, 0> { };
22
23
template
<
typename
T,
unsigned
N>
24
struct
extent
<T[], N> :
extent
<T, N - 1> { };
25
26
template
<
typename
T, size_t I>
27
struct
extent
<T[I], 0> :
integral_constant
<size_t, I> { };
28
29
template
<
typename
T, size_t I,
unsigned
N>
30
struct
extent
<T[I], N> :
extent
<T, N - 1> { };
31
32
/// \ingroup type_traits
33
template
<
typename
T
,
unsigned
N
= 0>
34
inline
constexpr
auto
extent_v
=
static_cast
<
size_t
>(
extent
<
T
,
N
>::
value
);
35
36
}
// namespace etl
37
38
#
endif
// TETL_TYPE_TRAITS_EXTENT_HPP
etl::extent_v
constexpr auto extent_v
Definition
extent.hpp:34
etl
Definition
adjacent_find.hpp:9
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:18
etl::integral_constant
Definition
integral_constant.hpp:11
include
etl
_type_traits
extent.hpp
Generated on Sat Sep 20 2025 23:50:58 for tetl by
1.9.8