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: " ~ T.stringof);
}
void TFoo(T : T[])(T[] a) {
pragma(msg, "T[]: " ~ T.stringof);
}
I noticed that an automatically deduced TFoo call always yields
the first, while TFoo!(uint[]) yields the array version if
present, and defaults to the first elsewise.
Am I incorrect in expecting the same behavior when (ab)using
argument deduction or does my usage make sense? I tried searching
for this combination (deduction & specialization) but couldn't
find another forum post / documentation example.