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. |
| Defined in header <type_traits>
|
||
| template< class T > struct decay; |
(C++11 起) | |
適用於左值,右值,數組與指針,函數指針的隱式轉換的類型
T,移除cv修飾符,並定義的成員typedeftype的結果類型。這是當按值傳遞給函數的所有參數的類型轉換.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; }; |
[编辑] 為例
| 本節是不完整的 原因: no example |
[编辑] 另請參閱
| implicit conversion | 數組與指針,函數指針,右值到左值的轉換
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. |