C++ Logo

std-proposals

Advanced search

Re: Make class template parameters available externally

From: Miguel Ojeda <miguel.ojeda.sandonis_at_[hidden]>
Date: Thu, 31 Oct 2019 01:54:38 +0100
On Thu, Oct 31, 2019 at 1:09 AM Sebastian Büttner via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> I don't think that the meaning is consistent here. Declaring something private isn't the same as not declaring it at all.
>
> Also: how is declaring a template parameter private/public affecting inheritance? Is the behavior consistent with class member access control? Is a private declared template parameter of class B not accessible in a derived class D? Can I declare a template parameter protected then?
>
> template<public class first_param, private class second_param>

No need for double keyword:

    template <public A, protected B, private C, class D>

where A/B/C are declared and D is not declared at all, as usual.

For NTTPs, not sure if the grammar is ambiguous or not, though; but it
would look clean too, e.g.:

    template <public size_t max_size>

If there is ambiguity, there is always the classic way as fallback.

Cheers,
Miguel

Received on 2019-10-30 19:57:07