◐ Shell
clean mode source ↗

std::decay — cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Déclaré dans l'en-tête

<type_traits>

template< class T > struct decay;

(depuis C++11)

S'applique lvalue-à-rvalue, array-à-pointeur et la fonction à pointer les conversions implicites à l'T type, supprime cv-qualifiés, et définit le type résultant en tant que membre type typedef. Il s'agit de la conversion de type appliqué à tous les arguments de la fonction quand passés par valeur .

Original:

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.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Types de membres

Nom

Original:

Name

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Definition
type

le résultat de l'application des conversions de type de désintégration de T

Original:

the result of applying the decay type conversions to T

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Mise en œuvre possible

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;
};

Exemple

Voir aussi

implicit conversion

ensemble à la fonction de pointeur, à pointeur, rvalue-à-lvalue conversions

Original:

array-to-pointer, function-to-pointer, rvalue-to-lvalue conversions

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.