Invoke a function/functor with parameters more than arguments

Solution 1:

One possibility:

#include <utility>
#include <cstddef>
#include <tuple>

template <std::size_t... Is, typename F, typename Tuple>
auto invoke_impl(int, std::index_sequence<Is...>, F&& func, Tuple&& args)
    -> decltype(std::forward<F>(func)(std::get<Is>(std::forward<Tuple>(args))...))
{
    return std::forward<F>(func)(std::get<Is>(std::forward<Tuple>(args))...);
}

template <std::size_t... Is, typename F, typename Tuple>
decltype(auto) invoke_impl(char, std::index_sequence<Is...>, F&& func, Tuple&& args)
{
    return invoke_impl(0
                     , std::index_sequence<Is..., sizeof...(Is)>{}
                     , std::forward<F>(func)
                     , std::forward<Tuple>(args));
}

template <typename F, typename... Args>
decltype(auto) invoke(F&& func, Args&&... args)
{
    return invoke_impl(0
                     , std::index_sequence<>{}
                     , std::forward<F>(func)
                     , std::forward_as_tuple(std::forward<Args>(args)...));
}

DEMO