Skip to main content

C++ named requirements: BinaryTypeTrait (since C++11)

A BinaryTypeTrait is a class template that describes a relationship between its two template type parameters with a intergral_constant (typically bool_constant) specialization.

Requirements

  • DefaultConstructible and CopyConstructible
  • Takes one template type parameter (additional template parameters are optional and allowed)
  • Publicly and unambiguously derived from a specialization of integral_constant, known as its base characteristic
  • The member names of the base characteristic are not hidden and are unambiguously available

Standard library

The following standard library class templates satisfy BinaryTypeTrait.

pubis_same(C++11)checks if two types are the same
pubis_base_of(C++17)checks if a type is derived from the other type
pubis_convertible(C++11)
is_nothrow_convertible(C++20)
checks if a type can be converted to the other type
pubis_invocable
is_invocable_r
is_nothrow_invocable
is_nothrow_invocable_r(C++17)
checks if a type can be invoked (as if by std::invoke) with the given argument types
pubuses_allocator(C++11)checks if the specified type supports uses-allocator construction

C++ named requirements: BinaryTypeTrait (since C++11)

A BinaryTypeTrait is a class template that describes a relationship between its two template type parameters with a intergral_constant (typically bool_constant) specialization.

Requirements

  • DefaultConstructible and CopyConstructible
  • Takes one template type parameter (additional template parameters are optional and allowed)
  • Publicly and unambiguously derived from a specialization of integral_constant, known as its base characteristic
  • The member names of the base characteristic are not hidden and are unambiguously available

Standard library

The following standard library class templates satisfy BinaryTypeTrait.

pubis_same(C++11)checks if two types are the same
pubis_base_of(C++17)checks if a type is derived from the other type
pubis_convertible(C++11)
is_nothrow_convertible(C++20)
checks if a type can be converted to the other type
pubis_invocable
is_invocable_r
is_nothrow_invocable
is_nothrow_invocable_r(C++17)
checks if a type can be invoked (as if by std::invoke) with the given argument types
pubuses_allocator(C++11)checks if the specified type supports uses-allocator construction