[Issue 5390] Make it possible to test whether a type is an instantiation of a particular template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 30 12:34:37 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5390
Michal Minich <michal.minich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |michal.minich at gmail.com
--- Comment #3 from Michal Minich <michal.minich at 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: -------
More information about the Digitalmars-d-bugs
mailing list