std::is_literal_type
Da 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; |
(a partir do C++ 11) | |
Se
T é um tipo literal, fornece o membro constante value true igual. Para qualquer outro 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.
Um tipo literal é qualquer tipo escalar, qualquer tipo de referência ou um tipo de classe 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. tem um destrutor 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 as suas chamadas do construtor e inicializadores para os membros nonstatic dados são expressões 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. é um tipo de agregado, ou tem pelo menos um construtor constexpr que não é uma cópia ou construtor movimento
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 os seus membros não estáticas de dados e classes base são tipos literais
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.
Uma matriz de tipos literais é também um 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.
Índice |
Inherited from std::integral_constant
Member constants
| value [estática] |
true se T is a literal type, false contrário 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. (membro estático público constante) |
Member functions
| operator bool |
converte o objeto em bool, retorna 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. (função pública membro) |
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
Apenas os tipos de literais podem ser usados como parâmetros para ou retornados de funções constexpr. Apenas classes literais podem ter funções constexpr membros.
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] Exemplo
#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