开发者

Type within namespace in c++

Suppose I defined A::B::int, how can I refer to开发者_如何转开发 the standard C++ int inside A::B?


You cannot have a typedef named int, even if it is in a namespace. int is a keyword.

Keywords are reserved for their specific uses and you cannot use them for any other purpose in your code.


You can't.

$3.4.2/2-

'If T is a fundamental type, its associated sets of namespaces and classes are both empty.

This means that fundamental types do not have any namespace associated with them.

So you can't even say ::int for this reason.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜