std::is_compound - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Definido no cabeçalho <type_traits> |
||
|
|
(desde C++11) | |
Se T é um tipo composto (ou seja, matriz, função, objeto ponteiro, ponteiro de função, ponteiro de objeto membro, ponteiro de função membro, classe de referência, união, ou enumeração, incluindo as variantes cv-qualificados), fornece o membro constante value true igual. Para qualquer outro tipo, é value false.
Original:
If T is a compound type (that is, array, function, object pointer, function pointer, member object pointer, member function pointer, reference, class, union, or enumeration, including any cv-qualified variants), 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.
Herdado de std::integral_constant
Member constants
Original:
The text has been machine-translated via Google Translate. (membro estático público constante) | |
Member functions
converte o objeto em Original: converts the object to The text has been machine-translated via Google Translate. (função pública membro) | |
Member types
Tipo Original: Type The text has been machine-translated via Google Translate. |
Definition |
value_type
|
bool
|
type
|
std::integral_constant<bool, value>
|
Notas
Tipos de compostos são os tipos que são construídos a partir de tipos fundamentais. Qualquer C + + tipo é fundamental ou composto.
Original:
Compound types are the types that are constructed from fundamental types. Any C++ type is either fundamental or compound.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Possível implementação
template< class T > struct is_compound : std::integral_constant<bool, !std::is_fundamental<T>::value> {};
Exemplo
#include <iostream> #include <type_traits> int main() { class cls {}; std::cout << (std::is_compound<cls>::value ? "T is compound" : "T is not a compound") << '\n'; std::cout << (std::is_compound<int>::value ? "T is compound" : "T is not a compound") << '\n'; }
Saída:
T is compound T is not a compound
Veja também
(C++11) |
verifica se um tipo é o tipo fundamental Original: checks if a type is fundamental type The text has been machine-translated via Google Translate. (modelo de classe) [edit] |
(C++11) |
verifica se um tipo é tipo escalar Original: checks if a type is scalar type The text has been machine-translated via Google Translate. (modelo de classe) [edit] |
(C++11) |
verifica se um tipo é tipo de objeto Original: checks if a type is object type The text has been machine-translated via Google Translate. (modelo de classe) [edit] |
(C++11) |
verifica se o tipo é um tipo de matriz Original: checks if a type is an array type The text has been machine-translated via Google Translate. (modelo de classe) [edit] |