std::is_void
STD::是[医]空隙
Defined in header | | |
---|---|---|
template< class T > struct is_void; | | (since C++11) |
检查是否T
是一种空型。提供成员常量。value
等于true
,如果T
类型void
,,,const void
,,,volatile void
,或const volatile void
.否则,value
等于false
...
模板参数
T | - | a type to check |
---|
辅助变量模板
template< class T > inline constexpr bool is_void_v = is_void | | (since C++17) |
---|
继承自STD:积分[医]常量
成员常数
value static | true if T is the type void (possibly cv-qualified) , 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> |
可能的实施
模板<class T>结构是[医]无效:std::is[医]相同的<void,type Name std::Remove[医]CV<T>*类型>{};
*。
例
二次
#include <iostream>
#include <type_traits>
int main()
{
std::cout << std::boolalpha;
std::cout << std::is_void<void>::value << '\n';
std::cout << std::is_void<int>::value << '\n';
}
二次
产出:
二次
true
false
二次
另见
is_array (C++11) | checks if a type is an array type (class template) |
---|---|
is_pointer (C++11) | checks if a type is a pointer type (class template) |
is_enum (C++11) | checks if a type is an enumeration type (class template) |
is_union (C++11) | checks if a type is an union type (class template) |
is_class (C++11) | checks if a type is a non-union class type (class template) |
is_function (C++11) | checks if a type is a function type (class template) |
is_object (C++11) | checks if a type is object type (class template) |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。