Przejdź do głównej zawartości

C++ named requirements: TransformationTrait (od C++11)

A TransformationTrait is a class template that provides a transformation of its template type parameter.

Requirements

  • Takes one template type parameter (additional template parameters are optional and allowed)
  • The transformed type is a publicly accessible nested type named type

Standard library

The type modifications and transformations all satisfy TransformationTrait.

The following standard library class templates also satisfy TransformationTrait.

pubstd::tuple_size<std::tuple>(C++11)obtains the size of tuple at compile time
pubstd::tuple_size<std::array>(C++11)obtains the size of an array
pubstd::tuple_size<std::pair>(C++11)obtains the size of a pair
pubvariant_size
variant_size_v(C++17)
obtains the size of the variant's list of alternatives at compile time

C++ named requirements: TransformationTrait (od C++11)

A TransformationTrait is a class template that provides a transformation of its template type parameter.

Requirements

  • Takes one template type parameter (additional template parameters are optional and allowed)
  • The transformed type is a publicly accessible nested type named type

Standard library

The type modifications and transformations all satisfy TransformationTrait.

The following standard library class templates also satisfy TransformationTrait.

pubstd::tuple_size<std::tuple>(C++11)obtains the size of tuple at compile time
pubstd::tuple_size<std::array>(C++11)obtains the size of an array
pubstd::tuple_size<std::pair>(C++11)obtains the size of a pair
pubvariant_size
variant_size_v(C++17)
obtains the size of the variant's list of alternatives at compile time