Expanding on my comment.
{ return __n != 0 ? _M_impl.allocate(__n) : 0; }
The first result can convert to bool
to int
. The second result can convert to int
. This is just as good a result as converting the second result to pointer
, so it is ambiguous.
But we don't want the bool
conversion to be available here, so we can make it explicit
. It will still be available in logical conditions and the like, as I describe here.
Being contextually convertable to bool
is another condition The Standard places on custom pointer types satisfying the NullablePointer
requirements (since 2011 - see 17.6.3.3/3).