 st8b7c:f320:99b9:690f:4595:cd17:293a:c069decay    Defined in header <type_traits>         template< class T >
struct decay;
    (since C++11)    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 st8b7c:f320:99b9:690f:4595:cd17:293a:c069add_pointer<F>8b7c:f320:99b9:690f:4595:cd17:293a:c069type. 
 Otherwise, the member typedef type is st8b7c:f320:99b9:690f:4595:cd17:293a:c069remove_cv<st8b7c:f320:99b9:690f:4595:cd17:293a:c069remove_reference<T>8b7c:f320:99b9:690f:4595:cd17:293a:c069type>8b7c:f320:99b9:690f:4595:cd17:293a:c069type. 
 These conversions model the type conversion applied to all function arguments when passed by value.
The behavior of a program that adds specializations for decay is undefined.
 Member types    Name   Definition 
   type   the result of applying the decay type conversions to T 
   Helper types    template< class T >
using decay_t = typename decay<T>8b7c:f320:99b9:690f:4595:cd17:293a:c069type;
    (since C++14)     Possible implementation    template< class T >
struct decay {
private:
    typedef typename st8b7c:f320:99b9:690f:4595:cd17:293a:c069remove_reference<T>8b7c:f320:99b9:690f:4595:cd17:293a:c069type U;
public:
    typedef typename st8b7c:f320:99b9:690f:4595:cd17:293a:c069conditional< 
        st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_array<U>8b7c:f320:99b9:690f:4595:cd17:293a:c069value,
        typename st8b7c:f320:99b9:690f:4595:cd17:293a:c069remove_extent<U>8b7c:f320:99b9:690f:4595:cd17:293a:c069type*,
        typename st8b7c:f320:99b9:690f:4595:cd17:293a:c069conditional< 
            st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_function<U>8b7c:f320:99b9:690f:4595:cd17:293a:c069value,
            typename st8b7c:f320:99b9:690f:4595:cd17:293a:c069add_pointer<U>8b7c:f320:99b9:690f:4595:cd17:293a:c069type,
            typename st8b7c:f320:99b9:690f:4595:cd17:293a:c069remove_cv<U>8b7c:f320:99b9:690f:4595:cd17:293a:c069type
        >8b7c:f320:99b9:690f:4595:cd17:293a:c069type
    >8b7c:f320:99b9:690f:4595:cd17:293a:c069type type;
}; 

  Example  #include <type_traits>
 
template <typename T, typename U>
constexpr bool is_decay_equ = st8b7c:f320:99b9:690f:4595:cd17:293a:c069is_same_v<st8b7c:f320:99b9:690f:4595:cd17:293a:c069decay_t<T>, U>;
 
int main()
{
    static_assert(
        is_decay_equ<int, int> &&
        ! is_decay_equ<int, float> &&
        is_decay_equ<int&, int> &&
        is_decay_equ<int&&, int> &&
        is_decay_equ<const int&, int> &&
        is_decay_equ<int[2], int*> &&
        ! is_decay_equ<int[4][2], int*> &&
        ! is_decay_equ<int[4][2], int**> &&
        is_decay_equ<int[4][2], int(*)[2]> &&
        is_decay_equ<int(int), int(*)(int)>
    );
}   See also     remove_cvref
(C++20)   combines st8b7c:f320:99b9:690f:4595:cd17:293a:c069remove_cv and st8b7c:f320:99b9:690f:4595:cd17:293a:c069remove_reference  (class template) 
   implicit conversion   array-to-pointer, function-to-pointer, lvalue-to-rvalue conversions 
  

    
{'path': 'public/docs/cpp/types/decay.html', 'source': 'DevDocs.IO'}