std::decay (3) - Linux Manuals
std::decay: std::decay
NAME
Synopsis
Defined in header <type_traits>
template< class T > (since C++11)
struct decay;
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. Formally:
* If T names the type "array of U" or "reference to array of U", the member typedef type is U*.
* Otherwise, if T is a function type F or a reference thereto, the member typedef type is std::add_pointer<F>::type.
* Otherwise, the member typedef type is std::remove_cv<std::remove_reference<T>::type>::type.
These conversions model the type conversion applied to all function arguments when passed by value.
Member types
Name Definition
type the result of applying the decay type conversions to T
Helper types
template< class T > (since C++14)
using decay_t = typename decay<T>::type;
Possible implementation
Example
// Run this code
Output:
See also
remove_cvref combines std::remove_cv and std::remove_reference
(C++20)
implicit_conversion array-to-pointer, function-to-pointer, lvalue-to-rvalue conversions