std::is_literal_type
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. |
<metanoindex/>
<tbody> </tbody>| definiert in Header <type_traits>
|
||
template< class T > struct is_literal_type; |
(seit C++11) | |
Wenn
T eine wörtliche Typ ist, bietet das Mitglied konstanten value gleich true. Für jede andere Art, value ist false .Original:
If
T is a literal type, 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.
Eine wörtliche Typ ist eine skalare Typ, jede Bezugnahme Typ oder eine Klasse-Typ, dass:
Original:
A literal type is any scalar type, any reference type or a class type that:
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.
Ein. hat einen trivialen Destruktor
Original:
1. has a trivial destructor
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.
2. all seinen Konstruktor Anrufe und Initialisierungen für nichtstatische Daten Mitglieder sind konstante Ausdrücke
Original:
2. all of its constructor calls and initializers for nonstatic data members are constant expressions
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.
3. ist ein Aggregat Typ oder mindestens ein constexpr Konstruktor, kein Kopieren oder Verschieben Konstruktor
Original:
3. is an aggregate type or has at least one constexpr constructor that is not a copy or move constructor
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.
4. alle seine nichtstatische Datenelemente und Basisklassen sind wörtliche Typen
Original:
4. all of its nonstatic data members and base classes are literal types
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.
Ein Array von literal-Typen ist auch eine wörtliche Typ .
Original:
An array of literal types is also a literal type.
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 literal type, false anders Original: true if T is a literal 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
Nur wörtliche Typen können als Parameter verwendet werden oder Retouren aus constexpr Funktionen. Nur wörtliche Klassen können constexpr Elementfunktionen .
Original:
Only literal types may be used as parameters to or returned from constexpr functions. Only literal classes may have constexpr member functions.
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.
Beispiel
#include <iostream>
#include <type_traits>
struct A {
int m;
};
struct B {
virtual ~B();
};
int main()
{
std::cout << std::boolalpha;
std::cout << std::is_literal_type<A>::value << '\n';
std::cout << std::is_literal_type<B>::value << '\n';
}
Output:
true
false