C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Make class template parameters available externally
From: Dmitry (dimanne_at_[hidden])
Date: 2019-10-30 17:19:29


>
> My quick survey shows that none of them do, not with those names. And
> a library implementation of what is specified to
> be
> template<class T, size_t N>
> struct array
> doesn't mention "T" or "N" anywhere in it.
>

Well, you did the survey wrong... Or misunderstood what exactly needs to be
surveyed :)
Let me explain in greater detail.
Here is vector https://en.cppreference.com/w/cpp/container/vector
Look at this:
value_type T
allocator_type Allocator

It means that template parameter T is declared as value_type, and template
parameter Allocator is declared as allocator_type. Now, the point is not in
the equality (or inequality) of names, but the main point is that all
containers (1) declare all their template parameters (value_type and
allocator_type) and (2) make them public. If you can find at least one such
container that does not do both (1) and (2), please, let me know.

> > Secondly, if there will be found a compelling enough argument for having
> the possibility to disable the feature, an approach similar to "= delete"
> can be adopted.
> > (or you can declare them in private section, as an alternative)
>
> Declaring private names is not the same thing as not declaring names.
> This seems to be starting a journey on the road where the benefit
> is not worth the cost.
>

Sure, what about =delete approach?
But again, much more important question (at least for me) as to why one
would want to hide them at first place (given that it is not possible to do
right now in the current C++)?

-- 
Dmitry
*Sent from gmail*


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

Standard Proposals Archives on Google Groups