std::type_identity (3) - Linux Manuals
std::type_identity: std::type_identity
Command to display std::type_identity
manual in Linux: $ man 3 std::type_identity
NAME
std::type_identity - std::type_identity
Synopsis
Defined in header <type_traits>
template< class T > (since C++20)
struct type_identity;
Provides the member typedef type that names T (i.e., the identity transformation).
Member types
Name Definition
type T
Helper types
template< class T > (since C++20)
using type_identity_t = typename type_identity<T>::type;
Possible implementation
template< class T >
struct type_identity {
using type = T;
};
Notes
type_identity can be used to block template_argument_deduction:
template<class T>
void f(T, T);
template<class T>
void g(T, std::type_identity_t<T>);
f(4.2, 0); // error, deduced conflicting types for 'T'
g(4.2, 0); // OK, calls g<double>
Example
This section is incomplete
Reason: no example
Pages related to std::type_identity
- std::type_index (3) - std::type_index
- std::type_index::hash_code (3) - std::type_index::hash_code
- std::type_index::name (3) - std::type_index::name
- std::type_index::operator==,!=,<,<=,>,>= (3) - std::type_index::operator==,!=,<,<=,>,>=
- std::type_index::type_index (3) - std::type_index::type_index
- std::type_info (3) - std::type_info
- std::type_info::before (3) - std::type_info::before
- std::type_info::hash_code (3) - std::type_info::hash_code
- std::type_info::name (3) - std::type_info::name
- std::type_info::operator==,std::type_info::operator!= (3) - std::type_info::operator==,std::type_info::operator!=
- std::type_info::~type_info (3) - std::type_info::~type_info
- std::tan(std::complex) (3) - std::tan(std::complex)