On Friday, 24 October 2014 at 14:13:10 UTC, ketmar via Digitalmars-d-learn wrote:

sorry if this is not what you mean, template magic sometimes scares me
and i'm loosing my mind. ;-)

What I meant was your example with the delegate parameter moved to the template list:

template Foo(T delegate(U) a, T, U) {}
Foo!((int x) => true); // T == bool, U == int


Or generalized to functions (and maybe "functors" in the unfortunate C++ sense):

template Foo(T(U) a, T, U) {}


Apparently, D doesn't allow type variables in value parameters at all.













Reply via email to