The syntax
|
identifier1 :: identifier2
| |
when parsed by the compiler, could be interpreted two different ways:
identifier1 could be a type (like a class, struct, or namespace), and identifier2 could
be a static data member inside that class, struct, or namespace. In any event,
identifier2 is a variable in this case and the expression is a
variable.
or
identifier1 could be a type (like a class, struct, or namespace), and identifier2 could
be a second type (class or struct only). In this case, the expression is a
type.
Although the compiler knows which one it is (by looking up the definition of identifier1
and identifier2 in its symbol table), if it names a type, it wants you to tell it that it is
a type. This is for your convenience, because the compiler just wants to know that
that is what you meant.
To tell it that it names a type, you prefix the expression with the keyword "typename"
as guestgulkan showed.