I read about std::is_pointer
in C++.
Then I wrote the program and check whether T
is a pointer type or not using std::is_pointer
.
#include <iostream>
int main()
{
std::cout<<std::boolalpha;
std::cout<<"char : " <<std::is_pointer<char>::value<<std::endl; // OK
std::cout<<"char * : "<<std::is_pointer<char *>::value<<std::endl; // OK
std::cout<<"char ** : "<<std::is_pointer<char **>::value<<std::endl; // OK
std::cout<<"char *** : "<<std::is_pointer<char ***>::value<<std::endl; // OK
std::cout<<"std::nullptr_t : "<<std::is_pointer<std::nullptr_t>::value<<std::endl; // Not ok, Why false??
}
Output : [Wandbox Demo]
char : false
char * : true
char ** : true
char *** : true
std::nullptr_t : false
Why is std::is_pointer<std::nullptr_t>::value
equal to false
?