Date: Mon, 28 Nov 2022 02:13:57 -0500
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_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?
Received on 2022-11-28 07:15:59