◐ Shell
clean mode source ↗

std::decay - cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Definido no cabeçalho

<type_traits>

template< class T > struct decay;

(desde C++11)

Aplica-se lvalue-a-rvalue, array para ponteiro, e função para-ponteiro conversões implícitas ao T tipo, remove CV-eliminatórias, e define o tipo resultante como o type membro typedef. Este é o tipo de conversão aplicada a todos os argumentos da função quando passados ​​por valor.

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.

Tipos de membro

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

o resultado da aplicação das conversões de tipo de decaimento para 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.

Possível implementação

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

Exemplo

Veja também

implicit conversion

matriz para-ponteiro, função para-ponteiro, rvalue-a-lvalue conversões

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.