Re: Template argument deduction not working with template specialization

2021-01-17 Thread Paul via Digitalmars-d-learn
I just figured out half of my frustration is caused by a collision between the 'alias this'd template possibillity and the normal one. For example: struct Bar(uint size, V) { V[size] blup; alias blup this; } void foo(S : T[], T)(S a) { pragma(msg, "first"); } void

Re: Template argument deduction not working with template specialization

2021-01-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/17/21 3:41 PM, Paul wrote: On Sunday, 17 January 2021 at 16:42:27 UTC, Steven Schveighoffer wrote: This works: void TFoo(T : U[], U)(T a) Oh cool, that's surprising to say the least. Thanks! This indeed works with argument deduction :) It's basically saying if T matches the pattern

Re: Template argument deduction not working with template specialization

2021-01-17 Thread Paul via Digitalmars-d-learn
On Sunday, 17 January 2021 at 16:42:27 UTC, Steven Schveighoffer wrote: I've always hated that aspect of specialization. I don't really understand why it's valid (how can T be T[]?) I totally agree with that, that confuses me as well. This works: void TFoo(T : U[], U)(T a) Oh cool, that's

Re: Template argument deduction not working with template specialization

2021-01-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/17/21 11:22 AM, Paul wrote: While trying to use template specializations I noticed the argument deductions do not yield the same version as the ones yielded when being explicit. Example: uint a = 1; uint[] b = [2]; TFoo(a); TFoo!(uint[])(b); void TFoo(T)(T a) { pragma(msg, "T: "