◐ Shell
clean mode source ↗

std::decay - cppreference.com

Da cppreference.com.

Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.

La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui.

Click here for the English version of this page

<metanoindex/>

<tbody> </tbody>

Elemento definito nell'header

<type_traits>

template< class T > struct decay;

(dal C++11)

Si applica lvalue-to-rvalue, array a puntatore, e la funzione a puntatore conversioni implicite al T tipo, rimuove cv-qualificazione, e definisce il tipo risultante come type membro typedef. Questa è la conversione di tipo applicato a tutti gli argomenti della funzione, quando passate per valore.

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.

Membri tipi

Nome

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

il risultato dell'applicazione delle conversioni di tipo a decadimento 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.

Possibile implementazione

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

Esempio

Vedi anche

implicit conversion

serie-a-puntatore, funzione-to-puntatore, rvalue a lvalue conversioni

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.