std::is_literal_type
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_literal_type; |
(ya que C + +11) | |
Si
T es un tipo literal, establece en el miembro constante value true iguales. Para cualquier otro tipo, es 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 literal es cualquier tipo escalar, cualquier tipo de referencia o un tipo de clase que:
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. tiene un destructor trivial
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. todas sus llamadas a constructores e inicializadores de miembros de datos no estáticos son expresiones constantes
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. es un tipo agregado o tiene al menos un constructor constexpr que no es una copia o constructor movimiento
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. todos sus miembros de datos estáticos y clases base son los tipos de literales
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.
Una matriz de tipos de literales es también un tipo literal .
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.
Contenido |
Inherited from std::integral_constant
Member constants
| value [estático] |
true si T is a literal type, false lo contrario 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. (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
Sólo los tipos de literales se puede utilizar como parámetros a funciones o regresar de constexpr. Sólo las clases literales pueden tener funciones miembro 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.
[editar] Ejemplo
#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