Applying a tuple to a function (and more)

Juanjo Alvarez juanjux at gmail.com
Sat Sep 18 10:59:49 PDT 2010


Hi,

I've just arrived to D 2.0 and after reading Andrei's book I'm loving
everything I'm seeing (except the bugs, of course).

I wanted to ask how these would be done, because I can't find how to do it:

1. Having the strings, defined at compile time, "MyClass" and "mymethod",
how could I could I get to a delegate to MyClass.mymethod?

2. Is there any way to apply a tuple to a function, expanding as arguments?

Like:

void f(int a, double b) {}
auto tup = tuple(42, 3.14);
f(<magic goes here with tup expanding as 42, 3.14>);

Thanks,
Juanjo



More information about the Digitalmars-d-learn mailing list