摘要:nullptr转换为bool,又bool转换为int,那为什么不nullptr转换为int?
这段代码没问题:
void f(bool);
f(nullptr); // fine, nullptr converts to bool
这没关系:
bool b;
int i(b); // fine, bool converts to int
那为什么这不行呢?
void f(int);
f(nullptr); // why not convert nullptr to bool, then bool to int?