std::is_standard_layout
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_standard_layout; |
(dal C++11) | |
Se
T
è un tipo di formato standard (cioè, un tipo scalare, uno standard-layout classe, o una matrice di questo tipo / classe, possibilmente cv qualificato), fornisce il membro costante value
true uguali. Per qualsiasi altro tipo, è value
false.Original:
If
T
is a standard layout type (that is, a scalar type, a standard-layout class, or an array of such type/class, possibly cv-qualified), 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.
Uno standard-layout della classe è una classe che
Original:
A standard-layout class is a class 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. non ci sono membri non statici di dati che non sono standard-layout
Original:
1. has no non-static data members that aren't standard-layout
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. non ha funzioni virtuali e non classi base virtuali
Original:
2. has no virtual functions and no virtual base classes
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. ha lo stesso controllo di accesso per tutti i non-membri dati statici
Original:
3. has the same access control for all non-static data members
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. non ci sono classi di base che non sono standard-layout
Original:
4. has no base classes that aren't standard-layout
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.
5. o non ha alcuna classe base con i non-membri dati statici o non ci sono non-membri dati statici nella classe più derivata e una sola base con loro
Original:
5. either has no base class with non-static data members or has no non-static data members in the most derived class and only one base with them
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.
6. non ci sono classi base dello stesso tipo come il primo membro non statico dati
Original:
6. has no base classes of the same type as the first non-static data member
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 standard-layout type , false altrimenti Original: true if T is a standard-layout 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
Un puntatore a una norma-layout di classe può essere convertito (con reinterpret_cast) a un puntatore al suo primo membro non statico di dati e viceversa.
Original:
A pointer to a standard-layout class may be converted (with reinterpret_cast) to a pointer to its first non-static data member and vice versa.
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.
Se uno standard di layout unione contiene due o più standard di layout strutture, è permesso di ispezionare la parte comune iniziale di loro.
Original:
If a standard-layout union holds two or more standard-layout structs, it is permitted to inspect the common initial part of them.
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.
Il offsetof macro può essere utilizzata solo con standard di layout classi.
Original:
The macro offsetof can only be used with standard-layout classes.
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 { int m1; private: int m2; }; struct C { virtual void foo(); }; int main() { std::cout << std::boolalpha; std::cout << std::is_standard_layout<A>::value << '\n'; std::cout << std::is_standard_layout<B>::value << '\n'; std::cout << std::is_standard_layout<C>::value << '\n'; }
Output:
true false false
[modifica] Vedi anche
(C++11) |
checks if a type is trivially copyable (classe template) |
(C++11) |
controlla se è un tipo semplice i dati vecchi (POD) di tipo Original: checks if a type is plain-old data (POD) type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |
byte offset dall'inizio di un layout di tipo standard per membro specificato Original: byte offset from the beginning of a standard-layout type to specified member The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione macro) |