Hi,

I would like to create a template that take a function as template parameter, create an arguments list for it, fill it with some data and call the function.

void foo(uint a, string b)
{
  // ...
}

void bar(long a, long b, string c)
{
  // ...
}

call(alias F)(JSONValue j)
{
  // create arguments list
  // assign arguments with the value from j
  // call the function
}

void main()
{
  call!foo(parseJSON("[123, \"nice\"]"));
  call!bar(parseJson("[1,2,3]"));
}

I found interesting stuff like ParameterTypeTuple! and Tuple! but I'm not be able to make it work together.

How can I do that?

Reply via email to