|
|
KarlisRepsons wrote: |
---|
So why can't I use "Index" as follows: |
|
|
Cpp03 Standard wrote: |
---|
A using-directive shall not appear in class scope, but may appear in namespace scope or in block scope. |
|
|
|
|
|
|
|
|
Ah okay. Further investigation has revealed that I was confusing a 'using declaration' with a 'using directive'. |
cpp03 Standard wrote: |
---|
7.3.3 The using declaration A using-declaration introduces a name into the declarative region in which the using-declaration appears. That name is a synonym for the name of some entity declared elsewhere. using-declaration: using typename opt ::opt nested-name-specifier unqualified-id ; using :: unqualified-id ; |
cpp03 Standard wrote: |
---|
7.3.4 Using directive using-directive: using namespace ::opt nested-name-specifieropt namespace-name ; A using-directive shall not appear in class scope, but may appear in namespace scope or in block scope. [Note: when looking up a namespace-name in a using-directive, only namespace names are considered, see 3.4.6. ] A using-directive specifies that the names in the nominated namespace can be used in the scope in which the using-directive appears after the using-directive. During unqualified name lookup (3.4.1), the names appear as if they were declared in the nearest enclosing namespace which contains both the using-directive and the nominated namespace. [Note: in this context, “contains” means “contains directly or indirectly”. ] A using-directive does not add any members to the declarative region in which it appears. |
KarlisRepsons wrote: |
---|
Add: still I would appreciate if anyone explains about using typedef. |
cpp03 Standard wrote: |
---|
7.1.3 The typedef specifier Declarations containing the decl-specifier typedef declare identifiers that can be used later for naming fundamental (3.9.1) or compound (3.9.2) types. The typedef specifier shall not be used in a function- definition (8.4), and it shall not be combined in a decl-specifier-seq with any other kind of specifier except a type-specifier. typedef-name: identifier A name declared with the typedef specifier becomes a typedef-name. Within the scope of its declaration, a typedef-name is syntactically equivalent to a keyword and names the type associated with the identifier in the way described in clause 8. A typedef-name is thus a synonym for another type. A typedef-name does not introduce a new type the way a class declaration (9.1) or enum declaration does. |
typedef HashIteratorBase<Key, T, Slots, Compare, Hash> HIB; |