http://d.puremagic.com/issues/show_bug.cgi?id=7529



--- Comment #6 from timon.g...@gmx.ch 2012-02-17 04:34:10 PST ---
(In reply to comment #5)
> The reason why this works with structs but not with templates is that a struct
> preserves the full type information while an alias template transforms a type.
> 
> void bar(Ty)(Ty) { pragma(msg, Ty); }
> 
> struct SList(T) {}
> template TList(T) { alias T TList; }
> 
> void main()
> {
>     bar(SList!int.init); // type SList!int => SList!int is preserved
>     bar(TList!int.init); // type int       => TList!int is lost
> }
> 
> Now if you take a function void foo(T)(TList!T) {} and gives you 'TList(T) =
> int'.
> What your asking for is an inverted template 'TList^-1(int) = T'.

Well, yes. But only for a simple set of cases where this is workable. Basically
the alias would need to be expanded before IFTI matching.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to