std::is_assignable, std::is_trivially_assignable, std::is_nothrow_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, class U > struct is_assignable; |
(1) | (dal C++11) |
template< class T, class U > struct is_trivially_assignable; |
(2) | (dal C++11) |
template< class T, class U > struct is_nothrow_assignable; |
(3) | (dal C++11) |
Se il std::declval<T>() = std::declval<U>() espressione è ben formato in un contesto non valutata, fornisce il membro costante
2) value
true uguali. Per qualsiasi altro tipo, è value
false.Original:
If the expression std::declval<T>() = std::declval<U>() is well-formed in unevaluated context, provides the member constant
value
equal true. For any other type, 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 dell'espressione di assegnazione non chiamerà qualsiasi operazione che non è banale.
3) Original:
same as 1), but evaluation of the 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 dell'espressione di assegnazione non chiamare qualsiasi operazione che non è noexcept.
Original:
same as 1), but the evaluation of the 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 assignable from U , false altrimenti Original: true if T is assignable from U , 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] Esempio
#include <iostream> #include <string> #include <type_traits> struct Ex1 { int n; }; int main() { std::cout << std::boolalpha << "int is assignable from double? " << std::is_assignable<int, double>::value << '\n' << "int& is nothrow assignable from double? " << std::is_nothrow_assignable<int&, double>::value << '\n' << "string is assignable from double? " << std::is_assignable<std::string, double>::value << '\n' << "Ex1& is trivially assignable from const Ex1&? " << std::is_trivially_assignable<Ex1&, const Ex1&>::value << '\n'; }
Output:
int is assignable from double? false int& is nothrow assignable from double? true string is assignable from double? true Ex1& is trivially assignable from const Ex1&? true
[modifica] Vedi anche
(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) |
(C++11) (C++11) (C++11) |
Verifica se un tipo ha un operatore di assegnamento mossa 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. (classe template) |