Skip to content

Instantly share code, notes, and snippets.

@nurupo
Forked from netbsduser/gist:14783987f2d1b17bc775
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nurupo/304870d1d572eff1bd00 to your computer and use it in GitHub Desktop.
Save nurupo/304870d1d572eff1bd00 to your computer and use it in GitHub Desktop.
template<typename Func, Func func> struct thunk;
template<typename Class, typename R, typename ...Args, R(Class::*func)(Args...)>
struct thunk<R(Class::*)(Args...), func>
{
static R call(Tox *tox, Args ...args, void *userData)
{
return ((*static_cast<Class *>(userData)).*func)(args...);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment