typedef A::T*(Processor::*myMethodType)(const FDS::T*);
myMethodType temp = NULL;
temp = reinterpret_cast<myMethodType> (myInterface.findMap(moname)))
Note: Processor is a class which instantiated Template class . myMethodType is the member-pointer-func pointer .
Note : findMap is returning a void* as seen below and myinterface is a map of
template <class Implementor>
void* Interface<Implementor>::findMap(std::string &name){
if (myInterface.find(moname) != myInterface.end()) {
return myInterface.find(moname)->second;
}
return NULL;
}
========================================================
Getting below error -
error: invalid cast from type âvoid*â to type âProcessor::myMethodType {aka T* (Processor::*)(const T*)}â
if((temp = reinterpret_cast<myMethodType> (myInterface.findMap(moname))) != NULL)
Question - why am I getting this error, though I am casting it to member_class_pointer? why Invalid conversion?
Tried till now :
Tried below approach from ---
https://stackoverflow.com/questions/1307278/casting-between-void-and-a-pointer-to-member-function
void myclass::static_fun(myclass *instance, int arg)
{
instance->nonstatic_fun(arg);
}
but no luck so far !!