21
Metaprogramming library
[meta]
21.2
Compile-time integer sequences
[intseq]
21.2.1
General
[intseq.general]
1
#
The library provides a class template that can represent an integer sequence
.
When used as an argument to a function template the template parameter pack defining the sequence can be deduced and used in a pack expansion
.
[
Note
1
:
The
index_
sequence
alias template is provided for the common case of an integer sequence of type
size_
t
; see also
[tuple.
apply]
.
—
end note
]
21.2.2
Class template
integer_
sequence
[intseq.intseq]
🔗
namespace
std
{
template
<
class
T, T
.
.
.
I
>
struct
integer_sequence
{
using
value_type
=
T;
static
constexpr
size_t size
(
)
noexcept
{
return
sizeof
.
.
.
(
I
)
;
}
}
;
}
1
#
Mandates
:
T
is an integer type
.
21.2.3
Alias template
make_
integer_
sequence
[intseq.make]
🔗
template
<
class
T, T N
>
using
make_integer_sequence
=
integer_sequence
<
T,
see below
>
;
1
#
Mandates
:
N
≥ 0
.
2
#
The alias template
make_
integer_
sequence
denotes a specialization of
integer_
sequence
with
N
non-type template arguments
.
The type
make_
integer_
sequence
<
T, N
>
is an alias for the type
integer_
sequence
<
T,
0
,
1
,
.
.
.
, N
-
1
>
.
[
Note
1
:
make_
integer_
sequence
<
int
,
0
>
is an alias for the type
integer_
sequence
<
int
>
.
—
end note
]