I want to achive the following behavior. In a base class I wish to have a container to store pointers to methods of derived class. (I want to store there h1 and h2). Base class is also implementing methods allowing to store those pointers and the container itself
There is not any code ready yet, cause I wonder whether it's possible at all - eg:
template<typename E, typename S>
using Map = std::unordered_map<E, std::function<S* (S&, void)>>;
template<typename E, typename S>
class Base {
someFunctToPutPointersIntoMap() {}
Map<E, S> mEventMap;
}
template<typename E, typename S>
class Derived: public Base<E, S> {
public:
Derived* h1(void) {};
Derived* h2(void) {};
};
However how then I can declare object of derived class? For me its parameters are recursive eg.
Derived<E, Derived<E, Derived<E, Derived<E, ...etc... > object;
So it will never compile. I am sure there is some way to handle it, however I have none idea.
` is invalid. It looks like you mean `std::function– aschepler Jun 17 '17 at 01:33`.