std::is_assignable, std::is_trivially_assignable, std::is_nothrow_assignable
提供: cppreference.com
|
|
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
| Defined in header <type_traits>
|
||
| template< class T, class U > struct is_assignable; |
(1) | (C++11およびそれ以降) |
| template< class T, class U > struct is_trivially_assignable; |
(2) | (C++11およびそれ以降) |
| template< class T, class U > struct is_nothrow_assignable; |
(3) | (C++11およびそれ以降) |
表現std::declval<T>() = std::declval<U>()は未評価の文脈でよく形成されている場合、メンバ定数
2) value等しいtrueを提供しています。その他のタイプのために、valuefalseです.Original:
If the expression std::declval<T>() = std::declval<U>() is well-formed in unevaluated context, provides the member constant
value equal true. For any other type, value is false.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.
1)と同じですが、代入式の評価は容易ではありません任意の操作を呼び出すことはありません.
3) Original:
same as 1), but evaluation of the assignment expression will not call any operation that is not trivial.
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.
1)と同じですが、代入式の評価は、noexceptされていない任意の操作を呼び出すことはありません.
Original:
same as 1), but the evaluation of the assignment expression will not call any operation that is not noexcept.
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.
目次 |
Inherited from std::integral_constant
Member constants
| value [静的] |
true T is assignable from U もし、そうでなければfalse Original: true if T is assignable from U , false otherwise The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリック静的メンバ定数) |
Member functions
| operator bool |
boolにオブジェクトは、 value返しに変換します Original: converts the object to bool, returns value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) |
Member types
| タイプ
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
bool
|
type
|
std::integral_constant<bool, value> |
[編集] 例
このコードを実行します
#include <iostream> #include <string> #include <type_traits> struct Ex1 { int n; }; int main() { std::cout << std::boolalpha << "int is assignable from double? " << std::is_assignable<int, double>::value << '\n' << "int& is nothrow assignable from double? " << std::is_nothrow_assignable<int&, double>::value << '\n' << "string is assignable from double? " << std::is_assignable<std::string, double>::value << '\n' << "Ex1& is trivially assignable from const Ex1&? " << std::is_trivially_assignable<Ex1&, const Ex1&>::value << '\n'; }
出力:
int is assignable from double? false int& is nothrow assignable from double? true string is assignable from double? true Ex1& is trivially assignable from const Ex1&? true
[編集] も参照してください
| (C++11) (C++11) (C++11) |
タイプかどうかをチェックするには、コピー代入演算子を持っています Original: checks if a type has a copy assignment operator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |
| (C++11) (C++11) (C++11) |
タイプかどうかをチェックするには、ムーブ代入演算子を持っています Original: checks if a type has a move assignment operator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |

