Skip to content

Instantly share code, notes, and snippets.

@netbsduser
Last active August 29, 2015 14:25
Show Gist options
  • Save netbsduser/14783987f2d1b17bc775 to your computer and use it in GitHub Desktop.
Save netbsduser/14783987f2d1b17bc775 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