Is there something like "apply"?

Robert M. Münch via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 28 10:48:17 PDT 2015


Hi, I have the following "problem": I have the parameters for a 
function in an array. Now I want to call a function with a specific 
arity and use the parameters from the array to call it.

Like this pseudo-code:

args = [10, 20];

def foo(a, b): return a + b;

print(foo(*args));

Is something like this possible in D?

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



More information about the Digitalmars-d-learn mailing list