On Tuesday, 16 October 2018 at 13:09:34 UTC, Steven Schveighoffer
wrote:
On 10/15/18 4:36 PM, Márcio Martins wrote:
[...]
Hm... didn't realize that. It seems to me like an odd
limitation, but I can see how it's ambiguous.
The solution is to double-template:
template incx(Args...)
{
void incx(T)(ref T t)
{
++t.x;
}
}
[...]
Not a bug, because when you explicitly specify template
parameters, they are specified in left-to-right order.
You have incx(T, Args...)(ref T t)
t.incx!(1, 2, 3); // 1 => T (error), 2 => Args[0], 3 => Args[1]
incx(t, 1, 2, 3); // typeof(t) => T (uses IFTI), Args == empty
tuple,
// 1, 2, 3 => extra runtime parameters that
don't match anything?
-Steve
Ahah! Template inception is exactly what I was looking for! Works
great!
Thanks for the solution and the explanation!