On Sunday, 11 December 2016 at 22:00:27 UTC, Kevin Balbas wrote:
Basically, I need some way to turn an array of strings
into an argument list at runtime.  Is this possible?

Write (or generate) a helper function that loops over the Parameters!Func tuple and populates it from the strings. Call the helper function.


// declare your arguments tuple
Parameters!Func args;

// populate the arguments
foreach(idx, ref arg; args) {
   arg = to!(typeof(arg))(string_args[idx]);
}

Func(args); // call the function with that tuple



The free sample of my book: https://www.packtpub.com/application-development/d-cookbook has a more in-depth example near the end of it.

Reply via email to