C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Access specifier for C++ Namespaces

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Sun, 18 Jun 2023 21:08:08 +0100
On Sun, 18 Jun 2023 at 20:41, Smith, Jim via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Hi All,
>
> Years ago I inquired about this, don't know if it was discussed further.
>
> In some cases we might want to limit access for some types declared in a
> namespace.
> Would it be feasible to at least add a private access specifier for
> Namespaces?
>
> For example:
>
> namespace Foo {
> ...
> private: {
> func() {}
> };
> };
>
> Would make func() accessible only inside the namespace.
>

What would that accomplish, given that any TU can reopen any namespace
(pedantry: except std, etc) at any time?

Have you looked at modules?

Received on 2023-06-18 20:08:20