I'm facing an issue where I'm trying to create a variadic member function with paramater pack of a specific type.
template <typename T>
struct A
{
using result_type = T;
T operator()(T a, T b)
{
return a+b;
}
};
template <typename Functor>
struct B
{
using T = typename Functor::result_type;
T operator()(Functor &&f, T... args)
{
return f(args...);
}
};
It is expected to work like:
A<int> a;
B<A<int>> b;
int result = b(a, 2, 3); // should return 5
However I get the following errors:
error: type 'T' (aka 'typename Functor::result_type') of function parameter pack does not contain any unexpanded parameter packs
T operator()(Functor &&f, T... args)
~^~~~~~~~
error: pack expansion does not contain any unexpanded parameter packs
return f(args...);
~~~~^
What would be the proper way to achieve the expected functionality?