On 2015-04-28 17:52:57 +0000, Adam D. Ruppe said:

This can also be automated with a bit of code in a lot of cases:

import std.traits;

ParameterTypeTuple!foo params;
foreach(index, ref param; params) {
     params[index] = args[index];
}

foo(params);


Move that into a helper function and you can call it apply.

Adam, thanks a lot! That's what I need. Great stuff.

You could also make that assignment in the loop to type conversion if you wanted, my jsvar.d does this to provide javascript-style functions with an apply method.

Yep, that's what I did. Really cool...

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

Reply via email to