0

Is it possible to deduce the argument types of a functor? For example:

struct foo {
    int operator()(double, std::string const&) const { return 0; }
};

template<class Foo>
struct bar
{
    using first_argument_type = /* type of the first argument of Foo::operator() */;
    using second_argument_type = /* type of the second argument of Foo::operator() */;
    using return_type = std::result_of_t<Foo(first_argument_type, second_argument_type)>;
};
0xbadf00d
  • 17,405
  • 15
  • 67
  • 107

0 Answers0