The first option will not work according to 188.8.131.52 of Standard C ++: 3.4.4 describes how name lookup proceeds for the identifier in an elaborated-type-specifier. ... If the identifier resolves to a typedef-name or a template type-parameter, the elaborated-type-specifier is ill-formed. [Note: this implies that within a class template with a template type-parameter T, the declaration
friend class T; is ill-formed. ]
The second has a slightly different problem:
An elaborated-type-specifier shall be used in a friend declaration for a class. The class-key of the elaborated-type-specifier is required.
The third option is just one of many variations with
typedef, and is rather an attempt to confuse the compiler than a real solution.
Ввійдіть щоб вподобати
Ввійдіть щоб прокоментувати