The point should be that in
Code:
#include <cstddef>
namespace
{
struct
{
template <class T, typename U>
operator U T::* () const { return static_cast<U T::*> (0); }
} null_ptr_to_member;
}
struct X
{
int n;
};
void want_pointer(int X::*)
{
}
void want_number(int)
{
}
int main()
{
want_pointer(null_ptr_to_member);
want_number(null_ptr_to_member);
//compare with NULL
want_pointer(NULL);
want_number(NULL);
}
the line
Code:
want_number(null_ptr_to_member);
produces an error whereas
doesn't. It is probably an error to pass a pointer value to want_number, but the compiler won't stop you with NULL.
I guess the language is going to fix the whole issue with the null_ptr keyword.