Skip to content

Instantly share code, notes, and snippets.

@isage
Last active September 3, 2022 08:47
Show Gist options
  • Save isage/21396276bdc6d2d8ae4a02beca2eee81 to your computer and use it in GitHub Desktop.
Save isage/21396276bdc6d2d8ae4a02beca2eee81 to your computer and use it in GitHub Desktop.
TAI_CONTINUE for C++
#ifndef _TAIHEN_HPP_
#define _TAIHEN_HPP_
#include <taihen.h>
template<typename type, typename... Args> type tai_continue(tai_hook_ref_t hook, Args... args) {
struct _tai_hook_user *cur, *next;
cur = (struct _tai_hook_user *)(hook);
next = (struct _tai_hook_user *)cur->next;
return (next == NULL) ?
((type(*)(Args... args))cur->old)(args...)
:
((type(*)(Args... args))next->func)(args...)
;
}
#undef TAI_CONTINUE
#define TAI_CONTINUE(type, ...) tai_continue<type>(__VA_ARGS__)
#undef TAI_MAIN_MODULE
#define TAI_MAIN_MODULE ((const char*)(void *)0)
#endif // _TAIHEN_HPP_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment