I am designing a template class Policy which needs to be able to handle pointers to other classes.
template <class P>
class Policy
{
private:
const P *state;
public:
Policy (P const* s) : state(s){};
};
This works fine. Now I want to inherit from the above template class and create new subclasses:
class Greedy : public Policy<???>
{
public:
template <typename P> Greedy (P const* s) : Policy(s) {}:
};
class Explora : public Policy<???>
{
public:
template <typename P> Explora (P const* s) : Policy(s) {}:
};
Problem is that when defining those classes I do not know what type they will be using for the base template class. Is this even possible to do ? I want the type obtained from the inherited class constructor (probably templated), and then pass it to the base class construtor. Can I do that ? If yes, how ? typedefining enums ? I have seen this question but it doesn't in my opinion really answer the question.