Possible Duplicate:
What exactly is nullptr?
I first thought it's a keyword. My present gcc doesn't highlight nullptr
in a different shade. To verify that, I wrote following:
void *&p = nullptr;
So I got some clue from the error that:
error: invalid initialization of non-const reference of type ‘void*&’ from an rvalue of type ‘std::nullptr_t’
If nullptr
is an object then is it really a pointer equivalent of simple 0
? In other word, suppose I write:
#define NULL nullptr
Is the above statement doesn't alter anything in my code ? Also, it would be interesting to know other use cases for std::nullptr_t
type as such.