◐ Shell
clean mode source ↗

std::is_compound – cppreference.com

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.

Inherited from std::integral_constant

Member constants

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

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.

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

Siehe auch

prüft, ob ein Typ ist Grundtypus

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.


(Klassen-Template) [edit]

(C++11)

prüft, ob ein Typ ist skalaren Typ

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.


(Klassen-Template) [edit]

(C++11)

prüft, ob ein Typ ist Objekttyp

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.


(Klassen-Template) [edit]

(C++11)

prüft, ob ein Typ ist ein Array-Typ

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.


(Klassen-Template) [edit]