std::is_literal_type
| Defined in header <type_traits> |  |  | 
|---|---|---|
| template< class T > struct is_literal_type; |  | (since C++11) (deprecated in C++17) | 
如果T满足…的所有要求LiteralType,提供成员常量。value平等true.对于任何其他类型,value是false...
如果std::remove_all_extents_t<T>是不完整的类型,而不是%28可能是cv-合格%29。void...
模板参数
| T | - | a type to check | 
|---|
辅助变量模板
| template< class T > inline constexpr bool is_literal_type_v = is_literal_type<T>::value; |  | (since C++17) (deprecated) | 
|---|
继承自STD:积分[医]常量
成员常数
| value static | true if T is a literal type, false otherwise (public static member constant) | 
|---|
成员函数
| operator bool | converts the object to bool, returns value (public member function) | 
|---|---|
| operator() (C++14) | returns value (public member function) | 
成员类型
| Type | Definition | 
|---|---|
| value_type | bool | 
| type | std::integral_constant<bool, value> | 
注记
只有文字类型可以用作参数,或从常数函数.只有文字类可能具有conexpr成员函数。
例
二次
#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二次
另见
二次
*。
 © cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

