Variadic templates are really useful for performing recursive operations. In this case, I would like each recursive call to work on two arguments, so I do not need to call the same function multiple times. For this, I can write:
f() {}
template<typename M,
typename N,
typename... Rest>
f(M arg1, N arg2, Rest... rest)
{
doStuff(arg1, arg2);
f(rest);
}
Then I would call it the following:
f(arg1a, arg1b,
arg2a, arg2b,
arg3a, arg3b);
However, if the call is not formatted so beautifully, and all the arguments are on the same line, or the column is broken to the wrong point, it becomes completely unreadable. Moreover, if the call may contain about a dozen pairs. I tried to fix this by requesting to pass a packet of parameter pairs. I would like the function to be called like this:
f({arg1a, arg1b},
{arg2a, arg2b},
{arg3a, arg3b});
, , . make_pair , . ? .