这是什么类型的声明符?
What kind of declarator is this?
所以我正在研究 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++ 语法的语法,我遇到了这个语法规则:
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).
旨在伴随语法的特定部分。