std::is_compound
Aus cppreference.com
<metanoindex/>
<tbody> </tbody>| definiert in Header <type_traits>
|
||
template< class T > struct is_compound; |
(seit C++11) | |
Wenn
T eine Verbindung Typ (dh Array, Funktion, Objekt-Pointer, Funktion Zeiger, Mitglied Objektzeiger, Member-Funktion Zeiger, eine Referenz, Klasse, Gewerkschaft oder Enumeration, einschließlich etwaiger cv qualifizierte Varianten) bietet, das Mitglied konstanten value gleich true. Für jede andere Art, value ist 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.
Inherited from std::integral_constant
Member constants
value [statisch] |
true wenn T is a compound type , false anders 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. (public static Mitglied konstanten) |
Member functions
operator bool |
wandelt das Objekt bool, gibt 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. (öffentliche Elementfunktion) |
Member types
Type
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>
|
Notes
Compound-Typen sind die Typen, die von Grundtypen aufgebaut sind. Jede C + + ist entweder grundlegende oder Verbindung .
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.
Mögliche Implementierung
template< class T >
struct is_compound : std::integral_constant<bool, !std::is_fundamental<T>::value> {};
|
Beispiel
#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
