◐ Shell
clean mode source ↗

std::decay – cppreference.com

Aus cppreference.com

<metanoindex/>

<tbody> </tbody>

definiert in Header

<type_traits>

template< class T > struct decay;

(seit C++11)

Gilt lvalue-to-rvalue, array-to-Zeiger und Funktion-to-Zeiger impliziten Konvertierungen der Art T, entfernt cv-Qualifikanten, und definiert die resultierende Art als Mitglied typedef type. Dies ist die Typkonvertierung galt für alle Funktionsargumente, wenn sie von Wert übergeben .

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.

Mitglied Typen

Name

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

das Ergebnis der Anwendung der Zerfall Typkonvertierungen zu 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.

Mögliche Implementierung

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

Beispiel

Siehe auch

implicit conversion

array-to-Zeiger-Funktion-to-Zeiger, rvalue-to-lvalue Konvertierungen

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.