class Handler{private:static Handler* handler_ptr=NULL;static int filterEvent(const SDL_Event* event_ptr){if(handler_ptr)return(handler_ptr->handleEvent(event_ptr));else return(-1);}static void registerFilter(){static bool registered=false;if(!registered){SDL_SetEventFilter(filterEvent);registered=true;}}public:Handler(){if(handler_ptr){/*error*/}else{handler_ptr=this;registerFilter();}}int handleEvent(const SDL_Event* event_ptr){/*handle event*/}};
You still wind up with a function that does nothing but resend events, but that is the price you pay for the additional level of abstraction.
As for why you cannot just pass a pointer to a member function that isn't static, it is because all member functions have an additional invisible parameter... namely 'this'.
I do something roughly similar in my own SDL code. An IApplication(and ultimately IMessageHandler) derived object exists, and does the polling for events(technically, outsources the polling to the event manager singleton), which it then broadcasts up the tree of objects attached to it (all derived from IMessageHandler) what event occurred. Only those objects that derive from IEventHandler actually care about the event messages, however, and these can range from the application itself to user interface controls, joystick managers, states in a state machine, or anything else that might need to monitor events.