std::is_move_assignable, std::is_trivially_move_assignable, std::is_nothrow_move_assignable
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <type_traits>
|
||
template< class T > struct is_move_assignable; |
(1) | (dal C++11) |
template< class T > struct is_trivially_move_assignable; |
(2) | (dal C++11) |
template< class T > struct is_nothrow_move_assignable; |
(3) | (dal C++11) |
Verifica se un tipo è
2) MoveAssignable
, cioè ha un accesso esplicito o implicito operatore di assegnazione mossa. Se la condizione è soddisfatta, un membro costante value
true parità è previsto, in caso contrario è value
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.
uguale a 1), ma la valutazione della mossa-assegnazione espressione non chiamerà qualsiasi operazione che non è banale.
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.
come 1), ma la valutazione del movimento assegnazione espressione non chiamare qualsiasi operazione che non è noexcept.
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.
Indice |
Inherited from std::integral_constant
Member constants
value [statico] |
true se T is move-assignable, false altrimenti 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. (pubblico membro statico costante) |
Member functions
operator bool |
converte l'oggetto in bool, restituisce 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. (metodo pubblico) |
Member types
Tipo
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> |
[modifica] Possibile implementazione
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> {}; |
[modifica] Esempio
#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
[modifica] Vedi anche
(C++11) (C++11) (C++11) |
Verifica se un tipo ha un operatore di assegnazione per un argomento specifico 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. (classe template) |
(C++11) (C++11) (C++11) |
Verifica se un tipo ha un operatore di assegnamento per copia 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. (classe template) |