I was reading http://bartoszmilewski.wordpress.com/2009/10/21/what-does-haskell-have-to-do-with-c/ and came across this code to check if a type is a pointer or not:
template<class T> struct
isPtr {
static const bool value = false;
};
template<class U> struct
isPtr<U*> {
static const bool value = true;
};
template<class U> struct
isPtr<U * const> {
static const bool value = true;
};
How do i specialize the general template to handle case for const pointer to a const type? If i do this:
std::cout << isPtr <int const * const>::value << '\n';
i get a true when i am expecting false. Can someone explain?
EDIT: using VC++ 2010 compiler (express :-)