Summary: nullptr
converts to bool
, and bool
converts to int
, so why doesn\'t nullptr
convert to int
The keyworkd nullptr is introduced in c++11 because multiple definition of the C NULL, and it confuses when overloading a function with int arguments and NULL.
#define NULL 0
#define NULL (void*)0
In the bible The C++ Programming Language (4th), page 270
The pointer-to-bool conversion is useful in conditions, but confusing elsewhere.
So I think nullptr_t varible convert to int is not allowed because that's the reason why it exists, but it can be used as a test condition like bool variables.