[intseq] (original) (raw)

21 Metaprogramming library [meta]

21.2 Compile-time integer sequences [intseq]


21.2.1 General [intseq.general]

21.2.2 Class template integer_sequence [intseq.intseq]

21.2.3 Alias template make_integer_sequence [intseq.make]


21.2.1 General [intseq.general]

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); } };}

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_>;

The alias templatemake_integer_sequence denotes a specialization ofinteger_sequence with N constant template arguments.

The type make_integer_sequence<T, N> is an alias for the typeinteger_sequence<T, 0, 1, …, N - 1>.

[Note 1:

make_integer_sequence<int, 0> is an alias for the typeinteger_sequence<int>.

— _end note_]