samedi 2 septembre 2017

Call function with part of variadic arguments

Consider I have the following:

void bar(int a, int b)
{
}   

template<typename F, typename... Args>
void foo(F function, Args... args>
{
    function(args...);
}

I would like to have some kind of way to only pass the necessary amount of arguments to the function, so that I would be able to do the following, which should result in a call to bar with 1, 2 as arguments discarding the 3.

foo(bar, 1, 2, 3);

Aucun commentaire:

Enregistrer un commentaire