The problem is the hidden “this” pointer to set_key(), which makes it no longer match the function prototype expected by define_key(). To avoid this, you have to declare set_key() to be a static method. (You can use the data pointer to pass in the this pointer again.)
OK, so this is very annoying. Since I can’t access non-static members from within a static function, I have to define all variables I want to use from within that function globally.
Isn’t there a way to tell define_key that it takes another argument, the this pointer? Or perhaps a better way to do things?