【发布时间】:2013-06-08 18:58:34
【问题描述】:
标准规定,nullptr 是 std::nullptr_t (2.14.7) 类型的指针文字。而 18.2p9 定义了nullptr_t by
namespace std {
typedef decltype(nullptr) nullptr_t;
}
By 7.1.6.2p4 decltype(nullptr) 是表达式nullptr 的类型,根据定义std::nullptr_t(因为表达式nullptr 是prvalue)。将其代入nullptr_t 的定义中会得到
typedef nullptr_t nullptr_t
另一方面,typedef 说明符不会引入新类型,它只是另一个现有类型的名称。那么,nullptr_t 到底是什么?我无法理解这些定义。
【问题讨论】: