Type traits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile-time rational arithmetic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile-time integer sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(C++14) |
Defined in header <type_traits> | ||
template<class T> struct is_void; | (since C++11) | |
std::is_void
is aUnaryTypeTrait.
Checks whetherT
is a void type. Provides the member constantvalue that is equal totrue, ifT
is the typevoid,constvoid,volatilevoid, orconstvolatilevoid. Otherwise,value is equal tofalse.
If the program adds specializations forstd::is_void
orstd::is_void_v
, the behavior is undefined.
Contents |
T | - | a type to check |
template<class T> constexprbool is_void_v= is_void<T>::value; | (since C++17) | |
value [static] | true ifT is the typevoid (possibly cv-qualified),false otherwise(public static member constant) |
operator bool | converts the object tobool, returnsvalue (public member function) |
operator() (C++14) | returnsvalue (public member function) |
Type | Definition |
value_type | bool |
type | std::integral_constant<bool, value> |
template<class T>struct is_void:std::is_same<void,typenamestd::remove_cv<T>::type>{}; |
#include <type_traits> void foo(); static_assert( std::is_void_v<void>==true and std::is_void_v<constvoid>==true and std::is_void_v<volatilevoid>==true and std::is_void_v<constvolatilevoid>==true and std::is_void_v<std::void_t<>>==true and std::is_void_v<void*>==false and std::is_void_v<int>==false and std::is_void_v<decltype(foo)>==false and std::is_void_v<std::is_void<void>>==false); int main(){}
(C++11) | checks if a type is an array type (class template)[edit] |
(C++11) | checks if a type is a pointer type (class template)[edit] |
(C++11) | checks if a type is an enumeration type (class template)[edit] |
(C++11) | checks if a type is a union type (class template)[edit] |
(C++11) | checks if a type is a non-union class type (class template)[edit] |
(C++11) | checks if a type is a function type (class template)[edit] |
(C++11) | checks if a type is an object type (class template)[edit] |