std::is_standard_layout
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_standard_layout; |
(ya que C + +11) | |
Si
T es un tipo de diseño estándar (es decir, un tipo escalar, una clase de normas de diseño, o una disposición de ese tipo / clase, posiblemente cv-calificados), establece en el miembro constante value true iguales. Para cualquier otro tipo, es 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.
Una clase de normas de diseño es una clase que
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. no tiene miembros de datos no estáticos que no son estándar-diseño
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. no tiene funciones virtuales y no hay clases base virtuales
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. tiene el control de acceso igual para todos los miembros no estáticos de datos
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. no tiene clases base que no son estándar-diseño
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 bien no tiene una clase base con los miembros no estáticos de datos o no tiene miembros no estáticos de datos de la clase más derivada y una sola base con ellos
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. no tiene clases base del mismo tipo que el primer no-estática miembro de datos
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.
Contenido |
Inherited from std::integral_constant
Member constants
| value [estático] |
true si T is a standard-layout type , false lo contrario 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. (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] Notas
Un puntero a una clase estándar de diseño puede ser convertido (con reinterpret_cast) a un puntero a su primer miembro no estático de datos y 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.
Si un sindicato de normas de diseño cuenta con dos o más estructuras de diseño estándar, está permitido para inspeccionar la parte inicial común de ellos .
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.
El offsetof macro sólo se puede utilizar con las clases de diseño estándar .
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.
[editar] Ejemplo
#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
[editar] Ver también
| (C++11) |
checks if a type is trivially copyable (clase de plantilla) |
| (C++11) |
Comprueba si un tipo es llano datos antiguos (POD) de 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. (clase de plantilla) |
| desplazamiento de bytes desde el comienzo de un tipo estándar de diseño de al miembro especificado 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. (función macro) | |