template<class T, T N>
using make_integer_sequence = integer_sequence<T, see below>;
Template | Condition | Comments | |
T is void | |||
T is an integral type ([basic.fundamental]) | |||
T is a floating-point type ([basic.fundamental]) | |||
T is an array type ([basic.compound]) of known or unknown extent | |||
T is a pointer type ([basic.compound]) | Includes pointers to functions
but not pointers to non-static members. | ||
T is an lvalue reference type ([dcl.ref]) | |||
T is an rvalue reference type ([dcl.ref]) | |||
T is a pointer to data member | |||
T is a pointer to member function | |||
T is an enumeration type ([basic.compound]) | |||
T is a union type ([basic.compound]) | |||
T is a non-union class type ([basic.compound]) | |||
T is a function type ([basic.compound]) |
Template | Condition | Comments | |
T is an lvalue reference or an rvalue reference | |||
T is an arithmetic type ([basic.fundamental]) | |||
T is a fundamental type ([basic.fundamental]) | |||
T is an object type ([basic.types.general]) | |||
T is a scalar type ([basic.types.general]) | |||
T is a compound type ([basic.compound]) | |||
T is a pointer-to-member type ([basic.compound]) |
Template | Condition | Preconditions | |
T is const-qualified ([basic.type.qualifier]) | |||
T is volatile-qualified ([basic.type.qualifier]) | |||
T is a trivial type ([basic.types.general]) | |||
T is a trivially copyable type ([basic.types.general]) | |||
T is a standard-layout type ([basic.types.general]) | |||
T is a class type, but not a union type, with no non-static data
members other than subobjects of zero size, no virtual member functions,
no virtual base classes, and no base class B for
which is_empty_v<B> is false. | |||
T is a polymorphic class ([class.virtual]) | |||
T is an abstract class ([class.abstract]) | |||
T is an aggregate type ([dcl.init.aggr]) | |||
If is_arithmetic_v<T> is true, the same result as
T(-1) < T(0);
otherwise, false | |||
If is_arithmetic_v<T> is true, the same result as
T(0) < T(-1);
otherwise, false | |||
T is an array type of known bound ([dcl.array]) | |||
T is an array type of unknown bound ([dcl.array]) | |||
T is a scoped enumeration ([dcl.enum]) | |||
For a function type T or
for a cv void type T,
is_constructible_v<T, Args...> is false,
otherwise see below | T and all types in the template parameter pack Args
shall be complete types, cv void,
or arrays of unknown bound. | ||
For a referenceable type T ([defns.referenceable]), the same result as
is_constructible_v<T, const T&>, otherwise false. | |||
The expression declval<T>() = declval<U>() is well-formed
when treated as an unevaluated
operand ([expr.context]). Only the validity of the immediate context
of the assignment expression is considered. [Note 3: The compilation of the
expression can result in side effects such as the instantiation of class template
specializations and function template specializations, the generation of
implicitly-defined functions, and so on. Such side effects are not in the βimmediate
contextβ and can result in the program being ill-formed. β end note] | |||
The expressions swap(declval<T>(), declval<U>()) and
swap(declval<U>(), declval<T>()) are each well-formed
when treated as an unevaluated operand ([expr.context])
in an overload-resolution context
for swappable values ([swappable.requirements]). Only the validity of the immediate context
of the swap expressions is considered. [Note 4: The compilation of the expressions can result in side effects
such as the instantiation of class template specializations and
function template specializations,
the generation of implicitly-defined functions, and so on. Such side effects are not in the βimmediate contextβ and
can result in the program being ill-formed. β end note] | |||
Either T is a reference type,
or T is a complete object type
for which the expression
declval<U&>().~U()
is well-formed
when treated as an unevaluated operand ([expr.context]),
where U is
remove_all_extents_t<T>. | |||
is_constructible_v<T, Args...> is true and the variable definition for is_constructible, as defined below, is known to call no operation that is not trivial ([basic.types.general], [special]). | T and all types in the template parameter pack Args shall be complete types,
cv void, or arrays of unknown bound. | ||
For a referenceable type T, the same result as
is_trivially_constructible_v<T, const T&>, otherwise false. | |||
For a referenceable type T, the same result as
is_trivially_constructible_v<T, T&&>, otherwise false. | |||
is_assignable_v<T, U> is true and the assignment, as defined by
is_assignable, is known to call no operation that is not
trivial ([basic.types.general], [special]). | |||
For a referenceable type T, the same result as
is_trivially_assignable_v<T&, const T&>, otherwise false. | |||
is_destructible_v<T> is true and
remove_all_extents_t<T> is either a non-class type or
a class type with a trivial destructor. | |||
is_constructible_v<T, Args...> is true
and the
variable definition for is_constructible, as defined below, is known not to
throw any exceptions ([expr.unary.noexcept]). | T and all types in the template parameter pack Args
shall be complete types, cv void,
or arrays of unknown bound. | ||
For a referenceable type T, the same result as
is_nothrow_constructible_v<T, const T&>, otherwise false. | |||
is_assignable_v<T, U> is true and the assignment is known not to
throw any exceptions ([expr.unary.noexcept]). | |||
For a referenceable type T, the same result as
is_nothrow_assignable_v<T&, const T&>, otherwise false. | |||
is_swappable_with_v<T, U> is true and
each swap expression of the definition of
is_swappable_with<T, U> is known not to throw
any exceptions ([expr.unary.noexcept]). | |||
For a referenceable type T,
the same result as is_nothrow_swappable_with_v<T&, T&>,
otherwise false. | |||
is_destructible_v<T> is true and the indicated destructor is known
not to throw any exceptions ([expr.unary.noexcept]). | |||
T has a virtual destructor ([class.dtor]) | |||
For an array type T, the same result as
has_unique_object_representations_v<remove_all_extents_t<T>>,
otherwise see below. | |||
T is a reference type, and
the initialization T t(VAL<U>); is
well-formed and binds t to
a temporary object whose lifetime is extended ([class.temporary]). Only the validity of the immediate context of
the variable initialization is considered. [Note 5: The initialization can result in effects such as
the instantiation of class template specializations and
function template specializations,
the generation of implicitly-defined functions, and so on. Such effects are not in the βimmediate contextβ and
can result in the program being ill-formed. β end note] | |||
T is a reference type, and
the initialization T t = VAL<U>;
is well-formed and binds t to
a temporary object whose lifetime is extended ([class.temporary]). Only the validity of the immediate context of
the variable initialization is considered. [Note 6: The initialization can result in effects such as
the instantiation of class template specializations and
function template specializations,
the generation of implicitly-defined functions, and so on. Such effects are not in the βimmediate contextβ and
can result in the program being ill-formed. β end note] |
Template | Value | |
alignof(T). | ||
If T is not an array type, or if it has rank less
than or equal to I, or if I is 0 and T
has type βarray of unknown bound of Uβ, then
0; otherwise, the bound ([dcl.array]) of the dimension of
T, where indexing of I is zero-based |
Template | Condition | Comments | |
template<class T, class U> struct is_same; | T and U name the same type with the same cv-qualifications | ||
Base is a base class of Derived ([class.derived])
without regard to cv-qualifiers
or Base and Derived are not unions and
name the same class type
without regard to cv-qualifiers | |||
see below | |||
is_convertible_v<From, To> is true and
the conversion, as defined by is_convertible,
is known not to throw any exceptions ([expr.unary.noexcept]) | |||
Derived is unambiguously derived from Base
without regard to cv-qualifiers,
and each object of type Derived
is pointer-interconvertible ([basic.compound]) with
its Base subobject,
or Base and Derived are not unions
and name the same class type
without regard to cv-qualifiers. | If Base and Derived are non-union class types
and are not (possibly cv-qualified versions of) the same type,
Derived shall be a complete type. | ||
The expression INVOKE(declval<Fn>(), declval<ArgTypes>()...) ([func.require])
is well-formed when treated as an unevaluated operand ([expr.context]) | Fn and all types in the template parameter pack ArgTypes
shall be complete types, cv void, or
arrays of unknown bound. | ||
The expression INVOKE<R>(declval<Fn>(), declval<ArgTypes>()...)
is well-formed when treated as an unevaluated operand | Fn, R, and all types in the template parameter pack ArgTypes
shall be complete types, cv void, or
arrays of unknown bound. | ||
is_invocable_v< Fn, ArgTypes...> is true and the expression INVOKE(declval<Fn>(), declval<ArgTypes>()...) is known not to throw any exceptions ([expr.unary.noexcept]) | Fn and all types in the template parameter pack ArgTypes
shall be complete types, cv void, or
arrays of unknown bound. | ||
is_invocable_r_v< R, Fn, ArgTypes...> is true and the expression INVOKE<R>(declval<Fn>(), declval<ArgTypes>()...) is known not to throw any exceptions ([expr.unary.noexcept]) | Fn, R, and all types in the template parameter pack ArgTypes
shall be complete types, cv void, or
arrays of unknown bound. |
Template | Comments | |
If T is a reference, function, or top-level const-qualified
type, then type denotes T, otherwise
T const. | ||
If T is a reference, function, or top-level volatile-qualified
type, then type denotes T, otherwise
T volatile. | ||
Template | Comments | |
If T has type βreference to T1β then the
member typedef type denotes T1;
otherwise, type denotes T. | ||
If T is a referenceable type ([defns.referenceable]) then
the member typedef type denotes T&;
otherwise, type denotes T. | ||
Template | Comments | |
If T is a (possibly cv-qualified) signed integer
type ([basic.fundamental]) then the member typedef
type denotes T; otherwise,
if T is a (possibly cv-qualified) unsigned integer
type then type denotes the corresponding
signed integer type, with the same cv-qualifiers as T;
otherwise, type denotes the signed integer type with smallest
rank ([conv.rank]) for which
sizeof(T) == sizeof(type), with the same
cv-qualifiers as T. | ||
If T is a (possibly cv-qualified) unsigned integer
type ([basic.fundamental]) then the member typedef
type denotes T; otherwise,
if T is a (possibly cv-qualified) signed integer
type then type denotes the corresponding
unsigned integer type, with the same cv-qualifiers as T;
otherwise, type denotes the unsigned integer type with smallest
rank ([conv.rank]) for which
sizeof(T) == sizeof(type), with the same
cv-qualifiers as T. |
Template | Comments | |
If T is βmultidimensional array of Uβ, the resulting member
typedef type denotes U, otherwise T. |
Template | Comments | |
If T has type β(possibly cv-qualified) pointer
to T1β then the member typedef type
denotes T1; otherwise, it denotes T. | ||
If T is a referenceable type ([defns.referenceable]) or a
cv void type then
the member typedef type denotes
remove_reference_t<T>*;
otherwise, type denotes T. |
Template | Comments | |
[Note 1: This behavior is similar to the lvalue-to-rvalue ([conv.lval]),
array-to-pointer ([conv.array]), and function-to-pointer ([conv.func])
conversions applied when an lvalue is used as an rvalue, but also
strips cv-qualifiers from class types in order to more closely model by-value
argument passing. β end note] | ||
template<bool B, class T,
class F> struct conditional; | ||
template<class... T> struct common_type; | ||
Unless this trait is specialized (as specified in Note D, below),
there shall be no member type. | ||
If T is an enumeration type, the member typedef type denotes
the underlying type of T ([dcl.enum]);
otherwise, there is no member type. | ||
If the expression INVOKE(declval<Fn>(), declval<ArgTypes>()...) ([func.require])
is well-formed when treated as an unevaluated operand ([expr.context]),
the member typedef type denotes the type
decltype(INVOKE(declval<Fn>(), declval<ArgTypes>()...));
otherwise, there shall be no member type. Only the validity of the immediate context of the
expression is considered. [Note 2: The compilation of the expression can result in side effects such as
the instantiation of class template specializations and function
template specializations, the generation of implicitly-defined
functions, and so on. Such side effects are not in the βimmediate
contextβ and can result in the program being ill-formed. β end note]
Preconditions: Fn and all types in the template parameter pack ArgTypes
are complete types, cv void, or arrays of
unknown bound. | ||
If T is
a specialization reference_wrapper<X> for some type X,
the member typedef type of unwrap_reference<T>
denotes X&,
otherwise type denotes T. | ||
template<class... B> struct conjunction : see below { };
template<class... B> struct disjunction : see below { };
template<class B> struct negation : see below { };
template<class S, class M>
constexpr bool is_pointer_interconvertible_with_class(M S::*m) noexcept;
template<class S1, class S2, class M1, class M2>
constexpr bool is_corresponding_member(M1 S1::*m1, M2 S2::*m2) noexcept;
constexpr bool is_constant_evaluated() noexcept;
consteval bool is_within_lifetime(const auto* p) noexcept;
Type | Value of X | Value of Y | |
ratio_add<R1, R2> | R1::num * R2::den + | R1::den * R2::den | |
R2::num * R1::den | |||
ratio_subtract<R1, R2> | R1::num * R2::den - | R1::den * R2::den | |
R2::num * R1::den | |||
ratio_multiply<R1, R2> | R1::num * R2::num | R1::den * R2::den | |
ratio_divide<R1, R2> | R1::num * R2::den | R1::den * R2::num |
template<class R1, class R2>
struct ratio_equal : bool_constant<R1::num == R2::num && R1::den == R2::den> { };
template<class R1, class R2>
struct ratio_not_equal : bool_constant<!ratio_equal_v<R1, R2>> { };
template<class R1, class R2>
struct ratio_less : bool_constant<see below> { };
template<class R1, class R2>
struct ratio_less_equal : bool_constant<!ratio_less_v<R2, R1>> { };
template<class R1, class R2>
struct ratio_greater : bool_constant<ratio_less_v<R2, R1>> { };
template<class R1, class R2>
struct ratio_greater_equal : bool_constant<!ratio_less_v<R1, R2>> { };