std::is_literal_type
Материал из 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. |
| Заголовочный файл <type_traits>
|
||
| template< class T > struct is_literal_type; |
(начиная с C++11) | |
Если
T является буквальным типа, обеспечивает постоянный член value равных true. Для любого другого типа, value является 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.
Буквальный тип любого скалярного типа, любой тип ссылки или тип класса, что:
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.
1. имеет тривиальный деструктор
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. Все его конструктор звонки и инициализаторы для нестатических членов данных являются постоянными выражениями
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. представляет собой совокупность типу или по крайней мере один КонстВыраж конструктор, который не копировать или перемещать конструктор
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. все его нестатических членов данных и базовые классы являются дословным типов
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.
Массив буквальном типов также является буквальным типа.
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.
Содержание |
Унаследован от std::integral_constant
Member constants
| value [static] |
true если T is a literal type, false иначе 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 константа-член) |
Member functions
| operator bool |
преобразует объект в bool, возвращает 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. (public функция-член) |
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
Только буквальном типа могут быть использованы в качестве параметров или возвращаемых из КонстВыраж функций. Только буквальном классы могут иметь КонстВыраж функций члена.
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.
[править] Пример
#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'; }
Вывод:
true false