std::is_copy_assignable, std::is_trivially_copy_assignable, std::is_nothrow_copy_assignable
提供: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 is_copy_assignable; |
(1) | (C + + 11以来) |
| template< class T > struct is_trivially_copy_assignable; |
(2) | (C + + 11以来) |
| template< class T > struct is_nothrow_copy_assignable; |
(3) | (C + + 11以来) |
小切手タイプが
2) CopyAssignableであるかどうか、すなわちアクセス可能な明示または暗黙のコピー代入演算子を持っています。要件が満たされている場合、メンバーは、一定value等しいtrueが提供され、そうでなければvaluefalseです.Original:
Checks whether a type is
CopyAssignable, i.e. has an accessible explicit or implicit copy assignment operator. If the requirement is met, a member constant value equal true is provided, otherwise 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 copy-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 copy-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 copy-assignableもし、そうでなければfalse Original: true if T is copy-assignable, 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> |
[編集] 可能な実装
template< class T> struct is_copy_assignable : std::is_assignable< typename std::add_lvalue_reference<T>::type, const typename std::add_lvalue_reference<T>::type> {}; template< class T> struct is_trivially_copy_assignable : std::is_trivially_assignable< typename std::add_lvalue_reference<T>::type, const typename std::add_lvalue_reference<T>::type> {}; template< class T> struct is_nothrow_copy_assignable : std::is_nothrow_assignable< typename std::add_lvalue_reference<T>::type, const typename std::add_lvalue_reference<T>::type> {}; |
[編集] 例
#include <iostream> #include <utility> #include <type_traits> struct Foo { int n; }; int main() { std::cout << std::boolalpha << "Foo is trivally copy-assignable? " << std::is_trivially_copy_assignable<Foo>::value << '\n' << "int[2] is copy-assignable? " << std::is_copy_assignable<int[2]>::value << '\n' << "int is nothrow copy-assignable? " << std::is_nothrow_copy_assignable<int>::value << '\n'; }
Output:
Foo is trivally copy-assignable? true int[2] is copy-assignable? false int is nothrow copy-assignable? true
[編集] も参照してください
| (C++11) (C++11) (C++11) |
タイプかどうかをチェックするには、特定の引数に代入演算子を持っています Original: checks if a type has a assignment operator for a specific argument 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. (クラステンプレート) |