Ok, I've found why, the value for the speed wasn't big anough, but it recrash in the delegate :
But I've a question can I set a pointer member function to null and doing something like this
template <typename R, typename O, typename ...A> class MemberFunction <R(O*, A...)> {
public :
MemberFunction (R(O::*f)(A...)) : function(f) {
constFunction = nullptr;
}
MemberFunction (R(O::*f)(A...) const) : constFunction(f) {
function = nullptr;
}
R operator() (O* object, A... args) {
if (function != nullptr)
return (object->*function)(args...);
else
return (object->*constFunction)(args...);
}
bool operator== (const MemberFunction<R(O*, A...)>& other) {
return function == other.function || constFunction == other.constFunction;
}
private :
R(O::*function)(A...);
R(O::*constFunction)(A...) const;
};
It tells me that the object onwich I call the member function pointer is null.
Or I've past it as a parameter...
listener.setActionParams("MoveAction", this, event.key.code,realTime.restart());
(Otherwise this code'll not compile anyway)
But I pass the parameters in different locations (the class listener pass it to the class action map, the class actionmap pass it to the generic delegate class, the generic delegate class try to do a cast from it's generic delegate object to a specific delegate object, if the cast is succesfull it means that it's on that function pointer which we want to change the params so it pass the params to the specific delegate object, then the specific delegate object store the params into a tuple.
When we call the action map's delegate, the delegate call the function of it's delegate using the polymorpism. (The function of the specific delegates is so called and pass the function's argument to the funtor which calls the right callback function. (The callback function take a pointer to a function member and it's argument and call the pointer to the function)
There are one callback function for each kind of function type. (member function, normal/static function, lambda function, etc...)
It worked well until I wanted to store two members function pointers into the same class because I've already a lot of classes and I didn't want to use one more class for const member functions.