C++ Logo

std-proposals

Advanced search

Re: Make class template parameters available externally

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 31 Oct 2019 00:04:16 +0200
On Wed, 30 Oct 2019 at 23:52, Dmitry <dimanne_at_[hidden]> wrote:
>>
>> So, basically,
>>
>> 1) when looking for a nested name, do normal lookup
>> 2) if that didn't find anything, look into the template parameters
>>
>> If I then _don't_ want to expose such a template parameter name, what do I do?
>
>
> Looks like you have not read my proposal :)
> Here is an excerpt from it:
>
> What if I did not want to redefine them?
> First of all, it turns out that they are a crucial part of an interface and often or always are of interest to end-users. A quick survey of STL shows that all containers declare all their template parameters and make them available to users.

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.

> 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.

Received on 2019-10-30 17:06:44