How do you use templates in D?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Tue Oct 18 12:01:58 PDT 2011
You could pass arbitrary functions like so:
auto genArray(T...)(T dgs)
if (allSatisfy!(isSomeFunction, T))
{
}
and call it:
genArray({ return cast(char) uniform(0, 128); },
{ return cast(int) uniform(0, 128); });
I'm not sure what you would want to do with lambdas with arbitrary
return types though. I'll leave someone else to answer Lispy things.
More information about the Digitalmars-d
mailing list