I came upon this sample code which the author said that std::is_pointer<T>::value always evaluate to false. The author didn't explain why this doesn't work and I haven't been able to find an explainable after search the web.This code wouldn't compile either with the error "incompatible operand type 'int' and 'int*'; i think this maybe related to the 'false' evaluation of the std::is_pointer<T>::value.
So what makes std::is_pointer<T>::value always evaluated to false in this case?
Code:template <typename T> void foo_bad(const T& val) { std::cout << (std::is_pointer<T>::value ? *val : val) << std::endl; }