Type traits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile-time rational arithmetic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile-time integer sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(C++14) |
Defined in header <type_traits> | ||
template<class T> struct remove_pointer; | (since C++11) | |
Provides the member typedeftype
which is the type pointed to byT
, or, ifT
is not a pointer, thentype
is the same asT
.
If the program adds specializations forstd::remove_pointer
, the behavior is undefined.
Contents |
Name | Definition |
type | the type pointed to byT orT if it's not a pointer |
template<class T> using remove_pointer_t=typename remove_pointer<T>::type; | (since C++14) | |
template<class T>struct remove_pointer{typedef T type;};template<class T>struct remove_pointer<T*>{typedef T type;};template<class T>struct remove_pointer<T*const>{typedef T type;};template<class T>struct remove_pointer<T*volatile>{typedef T type;};template<class T>struct remove_pointer<T*constvolatile>{typedef T type;}; |
#include <type_traits> static_assert(std::is_same_v<int,int>==true&&std::is_same_v<int,int*>==false&&std::is_same_v<int,int**>==false&&std::is_same_v<int, std::remove_pointer_t<int>>==true&&std::is_same_v<int, std::remove_pointer_t<int*>>==true&&std::is_same_v<int, std::remove_pointer_t<int**>>==false&&std::is_same_v<int, std::remove_pointer_t<int*const>>==true&&std::is_same_v<int, std::remove_pointer_t<int*volatile>>==true&&std::is_same_v<int, std::remove_pointer_t<int*constvolatile>>==true); int main(){}
(C++11) | checks if a type is a pointer type (class template)[edit] |
(C++11) | adds a pointer to the given type (class template)[edit] |