Re: Deducing a template argument from an aliased parameter

2016-01-01 Thread anonymous via Digitalmars-d-learn
On 31.12.2015 23:37, rcorre wrote: struct Vector(T, int N) { } alias Vector2(T) = Vector!(T, 2); void fun1(T)(Vector!(T, 2) vec) { } void fun2(T)(Vector2!T vec) { } unittest { fun1(Vector!(float, 2).init); fun2(Vector!(float, 2).init); } Why can fun1 deduce `T`, but fun2 can't?

Deducing a template argument from an aliased parameter

2015-12-31 Thread rcorre via Digitalmars-d-learn
In the following example, it seems like the signatures of fun1 and fun2 should be equivalent. Both accept a Vector!(T, 2), the only difference is that fun2 goes through an alias. struct Vector(T, int N) { } alias Vector2(T) = Vector!(T, 2); void fun1(T)(Vector!(T, 2) vec) { } void