Date: Thu, 31 Oct 2019 00:37:25 +0200
On Thu, 31 Oct 2019 at 00:19, Dmitry <dimanne_at_[hidden]> wrote:
> 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_typeT
> allocator_typeAllocator
>
> 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.
Right, sorry for my confusion, can't find any of those, save for the
packs like the one of tuple.
>> > 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++)?
It's plenty possible to do it in current C++, just write nothing.
Here's another question: now that I have this neat facility, I'll write
template <class value_type, class allocator_type> struct X{/* no
definitions for value_type nor allocator_type here*/};
template <class Foo, class Bar> struct Y : X<Foo, Bar> {};
Is Y supposed to have Y::value_type and Y::allocator_type?
> 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_typeT
> allocator_typeAllocator
>
> 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.
Right, sorry for my confusion, can't find any of those, save for the
packs like the one of tuple.
>> > 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++)?
It's plenty possible to do it in current C++, just write nothing.
Here's another question: now that I have this neat facility, I'll write
template <class value_type, class allocator_type> struct X{/* no
definitions for value_type nor allocator_type here*/};
template <class Foo, class Bar> struct Y : X<Foo, Bar> {};
Is Y supposed to have Y::value_type and Y::allocator_type?
Received on 2019-10-30 17:39:54