I have a template class defined (partially) as
template <class T> MyClass
{
public:
void DoSomething(){}
};
If I want to call DoSomething from another class, but I can do it for several "T" types in the same place, I am stuck with the idea, since the function pointers of the method are uniquely bound to the class type. Of course, each MyClass is a different type, so I cannot store pointers to objects in MyClassDoSomething () in a "polymorphic" form.
My use case is that I want to save the vector of function pointers to “DoSomething” in the hold class so that I can call the call for all saved classes from one place.
Does anyone have any suggestions?
source
share