Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
似乎nullptr是在默认的全局命名空间中声明的。将它放在名称空间中是否有意义std?
nullptr
std
nullptr是 C++11 关键字(与if, public, true,void等没有区别),因此不适用命名空间。
if
public
true
void
nullptr是一个指针文字,就像true是一个布尔文字一样。这个字面量的类型std::nullptr_t与你看到的一样。这个类型是在命名空间中定义的std::。指针字面量在 C++ 标准的第 2.14.7 节指针字面量中有描述。
std::nullptr_t
std::