C++ Logo

std-discussion

Advanced search

Re: Attaching a declaration

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Thu, 17 Feb 2022 09:56:41 -0500
On Thu, Feb 17, 2022 at 3:09 AM Vladimir Grigoriev <vlad.moscow_at_[hidden]> wrote:
>
> If the namespace is a part of the global module then what is the meaning to export it in a named module?

If you do `export namespace X { stuff }`, this makes this particular
namespace declaration an *export-declaration*. This means that the
declarations in "stuff" are all within an *export-declaration*. This
means that all declarations within "stuff" satisfy
[module.interface]/2.1. Therefore, all such declarations are
implicitly exported.

It's essentially shorthand for `export {namespace X{ stuff } }`.

Received on 2022-02-17 14:56:53