Original Post
Im creating this method pointer class which looks in a simplified form like this:
template <typename TCLASS, typename TRET=void, typename TARG=void>
class MethodPointer
{
private:
typedef TRET (TCLASS::*TMETHODPOINTER)(TARG);
TMETHODPOINTER method;
TCLASS* object;
public:
MethodPointer()
{
method = NULL;
object = NULL;
}
MethodPointer(TCLASS* object, TMETHODPOINTER method=NULL)
{
this->method = method;
this->object = object;
}
};
this works fine with method with arguments that is not of
type void. This:
class MyClass
{
public:
void myMethod()
{
// do whatever
}
MethodPointer<MyClass> methPtr;
MyClass()
{
methPtr = MethodPointer<MyClass>(this, &MyClass:myMethod);
}
};
This results with compiler error:
Cannot convert ''void (MyClass::*)()'' to ''void (MyClass::*)(void)''
Which is extremely annoying as this works:
typedef void (MyClass::*TMETHODPOINTER)(void);Eh, is my compiler simply stupid or is it supposed to be like this? Any help is greatly appreciated!