所以我在 C++ 语法中寻找语法问题,我发现了这个语法规则:
declarator:
direct-declarator
ptr-operator declarator
direct-declarator:
declarator-id
declarator-id:
id-expression
::opt nested-name-specifier(opt) type-name <------- oO
type-name:
class-name
enum-name
typedef-name
这让我想知道什么样的声明符中有 typename ?任何例子都会有所帮助。谢谢
最佳答案
这种形式仅存在于旧版本的 C++ 标准中。我猜它是用于构造函数定义的
void SomeClass::SomeClass() {}
我猜下面的措辞
A class-name has special meaning in a declaration of the class of that name and when qualified by that name using the scope resolution operator :: (5.1, 12.1, 12.4).
旨在伴随语法的特定部分。
关于c++ - 这是什么样的声明符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35660486/