std::is_move_assignable, std::is_trivially_move_assignable, std::is_nothrow_move_assignable
De 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_move_assignable; |
(1) | (ya que C + +11) |
| template< class T > struct is_trivially_move_assignable; |
(2) | (ya que C + +11) |
| template< class T > struct is_nothrow_move_assignable; |
(3) | (ya que C + +11) |
Comprueba si un tipo es
2) MoveAssignable, es decir, tiene un operador mover accesible asignación explícita o implícita. Si el requisito se cumple, un miembro constante value true igual se proporciona, de lo contrario es 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.
lo mismo que 1), pero la evaluación de la expresión movimiento asignación no llamar a cualquier operación que no es 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.
lo mismo que 1), pero la evaluación de la expresión movimiento asignación no llamar a cualquier operación que no se 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.
Contenido |
Inherited from std::integral_constant
Member constants
| value [estático] |
true si T is move-assignable, false lo contrario 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. (público miembro constante estática) |
Member functions
| operator bool |
convierte el objeto a bool, devuelve 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. (miembro público función) |
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] Posible implementación
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> {}; |
[editar] Ejemplo
#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
[editar] Ver también
| (C++11) (C++11) (C++11) |
Comprueba si un tipo tiene un operador de asignación para un 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. (clase de plantilla) |
| (C++11) (C++11) (C++11) |
Comprueba si un tipo tiene un operador de asignación de 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. (clase de plantilla) |