C++ Logo

std-proposals

Advanced search

Re: [std-proposals] New attribute to add implicit using statements for template parameter lists

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Mon, 28 Nov 2022 09:14:41 +0100
Hi,

You can't explicitly specify the template parameters of a partial specialisation. Those are always deduced.

Your partial specialisation examples can never be selected, as some of those template parameters are not used in deduced context.

I think the proposal raises some problems, but partial specialisation is not one of them.

Cheers,
Lénárd

On 28 November 2022 08:13:57 CET, Jason McKesson via Std-Proposals <std-proposals_at_[hidden]> wrote:
>On Sun, Nov 27, 2022 at 10:30 PM Ryan Klaus via Std-Proposals
><std-proposals_at_[hidden]> wrote:
>>
>> On Sun, Nov 27, 2022 at 9:05 PM Jason McKesson via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>>
>>>
>>> Template specialization is a thing. The parameters don't have to be
>>> the ones in the primary template.
>>
>>
>> Sorry, but I'm not sure we're on the same page here. I'm aware of template specialization, but how would template specialization allow me to omit namespaces inside a template parameter list?
>
>It wouldn't. What I'm saying is that the template arguments you give a
>template don't have to be the same ones as the parameters, due to
>specialization. Therefore, the compiler cannot *know* where `<RGBA,
>_8888>` should come from.
>
>Consider the following specialization:
>
>```
>template <Value1 val, Value2 val2>
>class Color<ToColorComponents(val2), ToLayout(val1)> { ... };
>```
>
>What if `Value1` is an enumeration that just so happens to have an
>RGBA enumerator? Which enumerator gets used?
>
>Or what if you have this:
>
>```
>template <typename T, ABC::ColorComponents layout>
>class Color<T::component, layout> { ... };
>
>struct RGBA
>{
> static inline constexpr ABC::ColorComponents component = ...;};
>
>Color<RGBA, _8888>
>```
>
>Which one gets used?
>--
>Std-Proposals mailing list
>Std-Proposals_at_[hidden]
>https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2022-11-28 08:14:48