So, I am trying to use variable templates to create objects from more convenient subtypes, but I am having problems in doing exactly what I want.
template<class ...Functor>
struct SeqMethod:public Functor...{
template<class F>
void call(F& a){
F::operator()();
}
template<class F,class ... funcs>
void call(){
F::operator()();
call<funcs...>();
}
public:
void operator()(){
call<Functor...>();
}
};
This is not valid syntax, so there.
Ideally, I would like to use something like this
class A{
public:
void operator()(){
std::cout<<"A";
}
};
class B{
public:
void operator()(){
std::cout<<"B";
}
};
class C:public SeqMethod<A,B>{};
Which in this case should output "AB", and is generally suitable for compiling behavior together.
source
share