Im trying to compare the address of two functions for equality. Type of my stored function is known. This system normally works, consider the following code (written as sample not from the program):
virtual bool compare(void *fn2) {
void (*fn)(int);
if(fn==fn2)
return true;
}
However when class functions came into consideration the same method doesn't work.
virtual bool compare(void *fn2) {
void(__thiscall myclass::*fn)(int);
void *fn2;
if(fn==fn2) //error C2440 type cast: cannot convert void* to void(__thiscall...
return true;
}
These functions override a common base class' pure virtual function similar to following:
virtual bool compare(void*) = 0;
Since I cannot use template<> in virtual functions I am out of options. Is there a way (anyway) to unify class functions and regular functions?
Thanks in advance, Cem