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+
namespace-definition:
|
| 11 |
+
named-namespace-definition
|
| 12 |
+
unnamed-namespace-definition
|
| 13 |
+
nested-namespace-definition
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
``` bnf
|
| 17 |
+
named-namespace-definition:
|
| 18 |
+
inlineₒₚₜ namespace attribute-specifier-seqₒₚₜ identifier '{' namespace-body '}'
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
``` bnf
|
| 22 |
+
unnamed-namespace-definition:
|
| 23 |
+
inlineₒₚₜ namespace attribute-specifier-seqₒₚₜ '{' namespace-body '}'
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
``` bnf
|
| 27 |
+
nested-namespace-definition:
|
| 28 |
+
namespace enclosing-namespace-specifier '::' inlineₒₚₜ identifier '{' namespace-body '}'
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
``` bnf
|
| 32 |
+
enclosing-namespace-specifier:
|
| 33 |
+
identifier
|
| 34 |
+
enclosing-namespace-specifier '::' inlineₒₚₜ identifier
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
``` bnf
|
| 38 |
+
namespace-body:
|
| 39 |
+
declaration-seqₒₚₜ
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Every *namespace-definition* shall inhabit a namespace scope
|
| 43 |
+
[[basic.scope.namespace]].
|
| 44 |
+
|
| 45 |
+
In a *named-namespace-definition* D, the *identifier* is the name of the
|
| 46 |
+
namespace. The *identifier* is looked up by searching for it in the
|
| 47 |
+
scopes of the namespace A in which D appears and of every element of the
|
| 48 |
+
inline namespace set of A. If the lookup finds a *namespace-definition*
|
| 49 |
+
for a namespace N, D *extends* N, and the target scope of D is the scope
|
| 50 |
+
to which N belongs. If the lookup finds nothing, the *identifier* is
|
| 51 |
+
introduced as a *namespace-name* into A.
|
| 52 |
+
|
| 53 |
+
Because a *namespace-definition* contains *declaration*s in its
|
| 54 |
+
*namespace-body* and a *namespace-definition* is itself a *declaration*,
|
| 55 |
+
it follows that *namespace-definition*s can be nested.
|
| 56 |
+
|
| 57 |
+
[*Example 1*:
|
| 58 |
+
|
| 59 |
+
``` cpp
|
| 60 |
+
namespace Outer {
|
| 61 |
+
int i;
|
| 62 |
+
namespace Inner {
|
| 63 |
+
void f() { i++; } // Outer::i
|
| 64 |
+
int i;
|
| 65 |
+
void g() { i++; } // Inner::i
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
— *end example*]
|
| 71 |
+
|
| 72 |
+
If the optional initial `inline` keyword appears in a
|
| 73 |
+
*namespace-definition* for a particular namespace, that namespace is
|
| 74 |
+
declared to be an *inline namespace*. The `inline` keyword may be used
|
| 75 |
+
on a *namespace-definition* that extends a namespace only if it was
|
| 76 |
+
previously used on the *namespace-definition* that initially declared
|
| 77 |
+
the *namespace-name* for that namespace.
|
| 78 |
+
|
| 79 |
+
The optional *attribute-specifier-seq* in a *named-namespace-definition*
|
| 80 |
+
appertains to the namespace being defined or extended.
|
| 81 |
+
|
| 82 |
+
Members of an inline namespace can be used in most respects as though
|
| 83 |
+
they were members of the innermost enclosing namespace. Specifically,
|
| 84 |
+
the inline namespace and its enclosing namespace are both added to the
|
| 85 |
+
set of associated namespaces used in argument-dependent lookup
|
| 86 |
+
[[basic.lookup.argdep]] whenever one of them is, and a *using-directive*
|
| 87 |
+
[[namespace.udir]] that names the inline namespace is implicitly
|
| 88 |
+
inserted into the enclosing namespace as for an unnamed namespace
|
| 89 |
+
[[namespace.unnamed]]. Furthermore, each member of the inline namespace
|
| 90 |
+
can subsequently be partially specialized [[temp.spec.partial]],
|
| 91 |
+
explicitly instantiated [[temp.explicit]], or explicitly specialized
|
| 92 |
+
[[temp.expl.spec]] as though it were a member of the enclosing
|
| 93 |
+
namespace. Finally, looking up a name in the enclosing namespace via
|
| 94 |
+
explicit qualification [[namespace.qual]] will include members of the
|
| 95 |
+
inline namespace even if there are declarations of that name in the
|
| 96 |
+
enclosing namespace.
|
| 97 |
+
|
| 98 |
+
These properties are transitive: if a namespace `N` contains an inline
|
| 99 |
+
namespace `M`, which in turn contains an inline namespace `O`, then the
|
| 100 |
+
members of `O` can be used as though they were members of `M` or `N`.
|
| 101 |
+
The *inline namespace set* of `N` is the transitive closure of all
|
| 102 |
+
inline namespaces in `N`.
|
| 103 |
+
|
| 104 |
+
A *nested-namespace-definition* with an *enclosing-namespace-specifier*
|
| 105 |
+
`E`, *identifier* `I` and *namespace-body* `B` is equivalent to
|
| 106 |
+
|
| 107 |
+
``` cpp
|
| 108 |
+
namespace E { \opt{inline} namespace I { B } }
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
where the optional `inline` is present if and only if the *identifier*
|
| 112 |
+
`I` is preceded by `inline`.
|
| 113 |
+
|
| 114 |
+
[*Example 2*:
|
| 115 |
+
|
| 116 |
+
``` cpp
|
| 117 |
+
namespace A::inline B::C {
|
| 118 |
+
int i;
|
| 119 |
+
}
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
The above has the same effect as:
|
| 123 |
+
|
| 124 |
+
``` cpp
|
| 125 |
+
namespace A {
|
| 126 |
+
inline namespace B {
|
| 127 |
+
namespace C {
|
| 128 |
+
int i;
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
— *end example*]
|
| 135 |
+
|