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


Michal Minich <michal.min...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michal.min...@gmail.com


--- Comment #3 from Michal Minich <michal.min...@gmail.com> 2010-12-30 12:32:30 
PST ---
This works:

import std.stdio;

class Dict (K, V) {}

void main () {
    Dict!(string, int) dict;
    Foo (dict);
}

template Foo (C : T!(P1, P2), alias T, P1, P2)
{
    void Foo (C container)
    {
        writeln(C.stringof);  // Dict
        writeln(T.stringof);  // Dict(K, V)
        writeln(P1.stringof); // string
        writeln(P2.stringof); // int
    }
}

Unfortunately it seems not to work with variadic templates, so overloads for
parameter P# need to be created currently, to make it practically generic. If
needed, this template can be called recursively in case P# is template
instance.

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

Reply via email to