C++ Logo


Advanced search

Subject: Re: [std-proposals] Make class template parameters available externally
From: Brian Bi (bbi5291_at_[hidden])
Date: 2019-10-30 16:40:08

On Wed, Oct 30, 2019 at 4:33 PM Ville Voutilainen via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Wed, 30 Oct 2019 at 23:20, Jake Arkinstall via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > On Wed, 30 Oct 2019, 20:49 Dmitry via Std-Proposals, <
> std-proposals_at_[hidden]> wrote:
> >>
> >> Your feedback is appreciated.
> >
> >
> > Every so often, someone posts a proposal idea on here that is so simple
> and elegant that I wonder why nobody has thought of it before.
> >
> > Usually those threads descend into some historical or technical reasons
> why it isn't feasible, but I hope this isn't one of those threads.
> I'd really love to not be such a spoilsport, but.. :)
> template <class shama, class lama>
> struct X;
> template <class ding, class dong>
> struct X;
> template <class RealNames, class GoHere>
> struct X
> {
> };
> Which names are to be made available? All of them?

It would make sense to only use the ones on the definition. (The ODR
requires multiple definitions to have the same sequence of tokens, so you
can't use different names in another translation unit.)

As an alternative, one might consider some more explicit syntax like this:

template <class value_type,

          class allocator_type>

struct vector {

using value_type;

using allocator_type;


The thing is that something like this:

using value_type = value_type;

is ill-formed under the current standard. So if we were to make the
proposed change, or the alternative I suggested, I think the first step is
to understand *why* the preceding declaration is ill-formed under the
current standard.

> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
*Brian Bi*

STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups