std::decay
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Заголовочный файл <type_traits>
|
||
| template< class T > struct decay; |
(начиная с C++11) | |
Применяется именующее к RValue, массива в указатель, и функция в указатель неявное преобразование к типу
T, снимает CV-классификаторов, а также определяет тип результате как член ЬурейеЕ type. Это преобразование типа применяется ко всем аргументам функции, когда передаются по значению.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.
You can help to correct and verify the translation. Click here for instructions.
Содержание |
[править] Член типов
| Имя
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
|
Результат применения преобразования распада типа
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. |
[править] Возможная реализация
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; }; |
[править] Пример
| Этот раздел не завершён Причина: нет примера |
[править] См. также
| implicit conversion | массива в указатель, функции в указатель, RValue к именующее преобразований
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. |