nullptr
has type std::nullptr_t
. It's implicitly convertible to any pointer type. Thus, it'll match std::nullptr_t
or pointer types in overload resolution, but not other types such as int
.
0
(aka. C's NULL bridged over into C++) could cause ambiguity in overloaded function resolution, among other things:
f(int);
f(foo *);
(Thanks to Caleth pointing this out in the comments.)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…