I have a class that inherits from 2 sets of base classes, according to variadic template arguments. One of those sets defines a virtual function. I want to do something like this but I’m not sure how it could compile:
template <class T>
struct Base {
void virtual foo(T t) = 0;
};
template <class T>
struct Holder {
T t;
};
template <class... T>
struct Child : Base<T>..., Holder<T>... {
template <class O>
void Base<O>::foo(O t) override { // << this won't compile
Holder<O>::t = t;
}
};
LIVE
It gives the following error:
error: invalid use of incomplete type ‘struct Base’
1