std::is_literal_type
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_literal_type; | (dal C++11) | |
Se
T
è un tipo letterale, fornisce l'elemento costante value
true uguali. Per qualsiasi altro tipo, è value
false.Original:
If
T
is a literal type, 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.
Un tipo letterale è qualsiasi tipo scalare, qualsiasi tipo di riferimento o di un tipo di classe che:
Original:
A literal type is any scalar type, any reference type or a class type that:
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.
1. ha un distruttore banale
Original:
1. has a trivial destructor
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.
2. tutte le sue chiamate costruttore e inizializzatori per non static membri dati sono espressioni costanti
Original:
2. all of its constructor calls and initializers for nonstatic data members are constant expressions
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.
3. è un tipo di aggregazione o ha almeno un costruttore constexpr che non è una copia o spostamento costruttore
Original:
3. is an aggregate type or has at least one constexpr constructor that is not a copy or move constructor
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.
4. tutti i suoi membri non statici di dati e le classi base sono tipi letterali
Original:
4. all of its nonstatic data members and base classes are literal types
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.
Un array di tipo letterale è anche un tipo letterale.
Original:
An array of literal types is also a literal type.
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 a literal type, false altrimenti Original: true if T is a literal type, 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]Note
Solo i tipi letterali possono essere utilizzati come parametri o restituiti da funzioni constexpr. Solo classi letterali possono avere funzioni membro constexpr.
Original:
Only literal types may be used as parameters to or returned from constexpr functions. Only literal classes may have constexpr member functions.
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.
[modifica]Esempio
#include <iostream>#include <type_traits> struct A {int m;}; struct B {virtual ~B();}; int main(){std::cout<<std::boolalpha;std::cout<< std::is_literal_type<A>::value<<'\n';std::cout<< std::is_literal_type<B>::value<<'\n';}
Output:
true false