For my program i need to define a Solver class which can either solve a problem or nested problem.
template< typename ProblemT >
struct Solver {
static void a() {
ProblemT::func();
}
};
template< typename < typename SubT> ProblemT >
struct Solver<ProblemT< SubT> > {
static void a() {
ProblemT::func();
SubT::func();
}
};
Usage:
Solver<Problem1> solver;
Solver<Problem2<Problem3> > nested_solver;
In the specialized version of Solver i need to know both ProblemT and SubT types in order to define the types correctly and call the correct functions.
Is there just a simple error or is it impossible to define such a class?
You can try something like this:
Obviously, you can decorate your primary
Solvertemplate with further member functions which you can access in the specialization, etc.