I want to transform all functions, which take tuples as arguments, passed to Foo into functions which take plain arguments.
auto f = [](const std::tuple<int, char>& t) { return std::get<0>(t); };
template <typename F>
auto Foo(F&& f) {
...
}
Foo(f)(42, 'a')
My idea was to do something like this
template <typename ReturnType, typename... Args>
auto Foo(std::function<ReturnType(const std::tuple<Args...>&)> f) {
return [&](Args&&... args) -> ReturnType {
return f({std::forward<Args>(args)...});
};
}
But compiler couldn't infer template arguments for a lambda and ignored this candidate.