std::is_scalar
Aus 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. |
definiert in Header <type_traits>
|
||
template< class T > struct is_scalar; |
(seit C++11) | |
Wenn
T
ein Skalar-Typ (das heißt, ein arithmetischer Typ, Aufzählungstyp, Zeiger, Zeiger auf ein Element oder std::nullptr_t, einschließlich etwaiger cv qualifizierte Varianten) ist, stellt das Mitglied konstanten value
gleich true. Für jede andere Art, value
ist false .Original:
If
T
is a scalar type (that is, arithmetic type, enumeration type, pointer, pointer to member, or std::nullptr_t, 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.
Inhaltsverzeichnis |
Inherited from std::integral_constant
Member constants
value [statisch] |
true wenn T is a scalar type , false anders Original: true if T is a scalar 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> |
[Bearbeiten] Notes
Jede einzelne Speicherstelle in der C + +-Speicher-Modell, einschließlich der verborgenen Speicherplätze durch Spracheigenschaften (zB virtuelle Tabellenzeiger) verwendet wird, hat skalaren Typ (oder eine Sequenz von benachbarten Bit-Bereichen nicht Null). Die Sequenzierung von Nebenwirkungen in der Auswertung eines Ausdrucks, interthread Synchronisation, und die Abhängigkeit der Bestellung sind alle in Bezug auf einzelne skalare Objekte definiert .
Original:
Each individual memory location in the C++ memory model, including the hidden memory locations used by language features (e.g virtual table pointer), has scalar type (or is a sequence of adjacent bit-fields of non-zero length). Sequencing of side-effects in expression evaluation, interthread synchronization, and dependency ordering are all defined in terms of individual scalar objects.
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.
[Bearbeiten] Mögliche Implementierung
template< class T > struct is_scalar : std::integral_constant<bool, std::is_arithmetic<T>::value || std::is_enum<T>::value || std::is_pointer<T>::value || std::is_member_pointer<T>::value || std::is_same<std::nullptr_t, typename std::remove_cv<T>::type>::value> {}; |
[Bearbeiten] Beispiel
Output:
T is scalar T is not a scalar
[Bearbeiten] Siehe auch
(C++11) |
prüft, ob ein Typ ist arithmetischen Typ Original: checks if a type is arithmetic 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) |
(C++11) |
prüft, ob eine Art ist ein Aufzählungstyp Original: checks if a type is an enumeration 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) |
(C++11) |
prüft, ob ein Typ ist ein Zeiger-Typ Original: checks if a type is a pointer 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) |
(C++11) |
checks if a type is a pointer to a non-static member function or object (Klassen-Template) |