Given e.g. a function template

void f(T ...)(T t) {
  writeln(t.length);
}

How can I call this function with an already-constructed tuple but pass the pule as an expressiontuple?

auto v = tuple(1, 2, 3);
f(v);

In the case above, f will print 1 because 1 tuple is given to the function, but I want to 'flatten' the tuple before the call, making the function see all the values in the tuple and thus print 3. I cannot change the function.

Similarly, I want to be able to do this:

auto v0 = tuple(1, 2, 3);
auto v1 = tuple(4, 5, 6);
f(some_function_to_combine_and_flatten_tuples(v0, v1));

And have f print 6.. Calling f(v0, v1) will print 2.

One reason for needing this is that I am using the receive function in std.concurrency, and I want to be able to merge message handlers from multiple locations.

Reply via email to