#include <iostream>
#include <string>
struct foo
{
void operator()( const int& ) { }
void operator()( const float& ) { }
void operator()( const std::string& ) { }
};
template<typename... Types>
void bar_recursive()
{
std::cout << "Iterating over overloads";
}
template<typename Fn>
void bar( Fn&& fn )
{
// Somehow i want to take first argument types of callable operators and pass them to bar_recursive function
bar_recursive< FirstArgumentTypesOfOverloadedCallableOperators... >( );
}
int main(int argc, char *argv[])
{
// I want bar() function to call bar_recursive< int , float , std::string >()
bar( foo {} );
return 0;
}
Those overloaded function call operators don't have arbitrary number of arguments. They all will have exactly one parameter.
Is it possible to deduce those types ?