std::is_move_assignable, std::is_trivially_move_assignable, std::is_nothrow_move_assignable
Da 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. |
Definido no cabeçalho <type_traits> | ||
template<class T > struct is_move_assignable; | (1) | (desde C++11) |
template<class T > struct is_trivially_move_assignable; | (2) | (desde C++11) |
template<class T > struct is_nothrow_move_assignable; | (3) | (desde C++11) |
Verifica se um tipo é
2) MoveAssignable
, ou seja, tem um operador de atribuição acessível explícita ou implícita movimento. Se a exigência for atendida, um membro constante value
true igual é fornecida, caso contrário, é 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.
mesmo que 1), mas a avaliação da expressão de atribuição movimento não irá chamar qualquer operação que não é trivial.
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.
mesmo que 1), mas a avaliação da expressão de atribuição movimento não irá chamar qualquer operação que não está 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.
Índice |
Herdado de std::integral_constant
Member constants
value [estática] | true se T is move-assignable, false contrário 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. (membro estático público constante) |
Member functions
operator bool | converte o objeto em bool, retorna 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. (função pública membro) |
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> |
[editar]Possível implementação
template<class T>struct is_move_assignable :std::is_assignable<typenamestd::add_lvalue_reference<T>::type, typenamestd::add_rvalue_reference<T>::type>{}; template<class T>struct is_trivially_move_assignable :std::is_trivially_assignable<typenamestd::add_lvalue_reference<T>::type, typenamestd::add_rvalue_reference<T>::type>{}; template<class T>struct is_nothrow_move_assignable :std::is_nothrow_assignable<typenamestd::add_lvalue_reference<T>::type, typenamestd::add_rvalue_reference<T>::type>{}; |
[editar]Exemplo
#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';}
Saída:
std::string is nothrow move-assignable? true int[2] is move-assignable? false Foo is trivially move-assignable? true
[editar]Veja também
(C++11) (C++11) (C++11) | verifica se um tipo tem um operador de atribuição para um argumento específico 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. (modelo de classe) |
(C++11) (C++11) (C++11) | verifica se um tipo tem um operador de atribuição de cópia 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. (modelo de classe) |