The following code doesn't work. Its intent is to pass arguments to variadic base classes. Is this possible, and if so, what's the right way to implement it? (Clang's error message is: an initializer for a delegating constructor must appear alone
, which I don't understand.)
template<class... Visitors>
class Visited: public Visitors...
{
public:
template<class F>
Visited(const F& f): F(f) {}
template<class F, class... Rest>
Visited(const F& f, const Rest&... r):
F(f), Visited(r...) {}
};
struct A {};
struct B {};
struct C {};
int main()
{
A a;
B b;
C c;
Visited<A,B,C> v(a, b, c);
}