Function template argument deduction
Paul Backus
snarwin at gmail.com
Sat Apr 7 14:02:55 UTC 2018
On Saturday, 7 April 2018 at 06:26:24 UTC, Uknown wrote:
> What I did notice though is that when
> `string list2string(T)(List!T list)` was changed to
> `string list2string(T)(VariantN!(16LU, Nil, Tuple!(T, "head",
> This*, "tail")) list)`
> The compiler correctly deduce `T` to be `int`
Interesting. Looks like this is an issue with aliases, because I
get the error with this code too:
--- test.d
import std.typecons: Tuple, tuple;
alias Pair(T) = Tuple!(T, T);
void foo(T)(Pair!T p)
{
return;
}
unittest {
Pair!int x = tuple(1, 2);
foo(x);
}
---
More information about the Digitalmars-d-learn
mailing list