From Cppreference
|
|
|
|
|
template< class T > struct decay;
|
|
(C++11 feature)
|
|
|
Applies lvalue-to-rvalue, array-to-pointer, and function-to-pointer implicit conversions to the type T, removes cv-qualifiers, and defines the resulting type as the member typedef type. This is the type conversion applied to all function arguments when passed by value.
[edit] Member types
|
Name
|
Definition
|
|
type
|
the result of applying the decay type conversions to T
|
[edit] Equivalent definition
template< class T >
struct decay {
typedef typename std::remove_reference<T>::type U;
typedef typename std::conditional<
std::is_array<U>::value,
typename std::remove_extent<U>::type*,
typename std::conditional<
std::is_function<U>::value,
typename std::add_pointer<U>::type,
typename std::remove_cv<U>::type
>::type
>::type type;
};
|
[edit] Example
[edit] See also