std::is_move_assignable, std::is_trivially_move_assignable, std::is_nothrow_move_assignable
Aus 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. |
definiert in Header <type_traits>
|
||
template< class T > struct is_move_assignable; |
(1) | (seit C++11) |
template< class T > struct is_trivially_move_assignable; |
(2) | (seit C++11) |
template< class T > struct is_nothrow_move_assignable; |
(3) | (seit C++11) |
gemischt. Prüft, ob eine Art
2) MoveAssignable
ist, dh eine zugängliche explizite oder implizite move Zuweisungsoperator. Wenn die Bedingung erfüllt ist, ein Mitglied konstanten value
gleich true bereitgestellt wird, sonst value
ist false .Original:
Checks whether a type is
MoveAssignable
, i.e. has an accessible explicit or implicit move 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.
wie 1), aber Auswertung der Bewegung Zuweisungsausdruck nicht nennen sämtliche Aufgaben, die nicht trivial ist .
3) Original:
same as 1), but evaluation of the move-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.
wie 1), aber die Auswertung der Bewegung Zuweisungsausdruck nicht nennen jede Operation, die nicht noexcept wird .
Original:
same as 1), but the evaluation of the move-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.
Inhaltsverzeichnis |
Inherited from std::integral_constant
Member constants
value [statisch] |
true wenn T is move-assignable, false anders Original: true if T is move-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. (public static Mitglied konstanten) |
Member functions
operator bool |
wandelt das Objekt bool, gibt 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. (öffentliche Elementfunktion) |
Member types
Type
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> |
[Bearbeiten] Mögliche Implementierung
template< class T> struct is_move_assignable : std::is_assignable< typename std::add_lvalue_reference<T>::type, typename std::add_rvalue_reference<T>::type> {}; template< class T> struct is_trivially_move_assignable : std::is_trivially_assignable< typename std::add_lvalue_reference<T>::type, typename std::add_rvalue_reference<T>::type> {}; template< class T> struct is_nothrow_move_assignable : std::is_nothrow_assignable< typename std::add_lvalue_reference<T>::type, typename std::add_rvalue_reference<T>::type> {}; |
[Bearbeiten] Beispiel
#include <iostream> #include <string> #include <type_traits> struct Foo { int n; }; int main() { std::cout << std::boolalpha << "std::string is nothrow move-assignable? " << std::is_nothrow_move_assignable<std::string>::value << '\n' << "int[2] is move-assignable? " << std::is_move_assignable<int[2]>::value << '\n' << "Foo is trivally move-assignable? " << std::is_trivially_move_assignable<Foo>::value << '\n'; }
Output:
std::string is nothrow move-assignable? true int[2] is move-assignable? false Foo is trivially move-assignable? true
[Bearbeiten] Siehe auch
(C++11) (C++11) (C++11) |
prüft, ob ein Typ hat einen Zuweisungsoperator für eine bestimmte Argument 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. (Klassen-Template) |
(C++11) (C++11) (C++11) |
prüft, ob ein Typ hat eine Kopie Zuweisungsoperator 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. (Klassen-Template) |