std::is_compound
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_compound; |
(ya que C + +11) | |
Si
T es un tipo compuesto (es decir, matriz, función, objeto puntero, puntero de función, el puntero del objeto miembro, puntero a función miembro, de referencia, de clase, unión o enumeración, incluidas las variantes cv-calificados), establece en el miembro constante value true iguales. Para cualquier otro tipo, es 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.
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 compound type , false lo contrario Original: true if T is a compound 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
Tipos de compuestos son los tipos que son construidos de tipos fundamentales. Cualquier tipo C + + o es fundamental o compuesto .
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.
You can help to correct and verify the translation. Click here for instructions.
[editar] Posible implementación
template< class T > struct is_compound : std::integral_constant<bool, !std::is_fundamental<T>::value> {}; |
[editar] Ejemplo
#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'; }
Output:
T is compound T is not a compound
[editar] Ver también
| (C++11) |
Comprueba si un tipo es el tipo fundamental Original: checks if a type is fundamental 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) |
| (C++11) |
Comprueba si un tipo es de tipo escalar Original: checks if a type is scalar 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) |
| (C++11) |
Comprueba si un tipo es tipo de objeto Original: checks if a type is object 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) |
| (C++11) |
Comprueba si un tipo es un tipo de matriz Original: checks if a type is an array 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) |