Files
2025-10-25 03:02:53 +03:00

2.2 KiB

[basic.namespace.general]

9 Declarations [dcl]

9.9 Namespaces [basic.namespace]

9.9.1 General [basic.namespace.general]

1

#

A namespace is an optionally-named entity whose scope can contain declarations of any kind of entity.

The name of a namespace can be used to access entities that belong to that namespace; that is, the members of the namespace.

Unlike other entities, the definition of a namespace can be split over several parts of one or more translation units and modules.

2

#

[Note 1:

A namespace-definition is exported if it contains anyexport-declarations ([module.interface]).

A namespace is never attached to a named module and never has a name with module linkage.

— end note]

[Example 1: export module M;namespace N1 {} // N1 is not exportedexport namespace N2 {} // N2 is exportednamespace N3 { export int n; } // N3 is exported — end example]

3

#

There is a global namespace with no declaration; see [basic.scope.namespace].

The global namespace belongs to the global scope; it is not an unnamed namespace ([namespace.unnamed]).

[Note 2:

Lacking a declaration, it cannot be found by name lookup.

— end note]