Possible Duplicate:
using declaration in variadic template
I recently came across a generic mechanism for combining two function objects to form a new function object that behaves as if the first two were overloaded:
template <typename F1, typename F2>
struct overload : public F1, public F2
{
overload(F1 f1, F2 f2) : F1(f1), F2(f2) {}
using F1::operator();
using F2::operator();
};
I am trying to extend this idea to work for N function objects, using variadic templates:
template <typename... Fs>
struct overload : public Fs...
{
overload(Fs... fs) : Fs(fs)... {}
using Fs::operator();...
};
However, GCC complains about my attempt to do variadic expansion on the using-declaration:
test.cpp:6:24: error: parameter packs not expanded with '...':
using Fs::operator();...
^
test.cpp:6:24: note: 'Fs'
test.cpp:6:26: error: expected unqualified-id before '...' token
using Fs::operator();...
^
I've tried some variations, such as:
using Fs::operator()...;
and
using Fs...::operator();
but neither do the trick.
Is it possible to do this?