Skip to content

Instantly share code, notes, and snippets.

@johnbartholomew
Created November 1, 2012 05: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 johnbartholomew/3992010 to your computer and use it in GitHub Desktop.
Save johnbartholomew/3992010 to your computer and use it in GitHub Desktop.
template <typename T> struct ForceConstRef { typedef const T& type; };
template <typename T> struct ForceConstRef<const T&> { typedef const T& type; };
template <typename T> struct ForceConstRef<const T> { typedef const T& type; };
template <typename T> struct ForceConstRef<T&> { typedef const T& type; };
template <typename T0, typename T1>
class LuaSignalTrampoline : public LuaSignalTrampolineBase {
public:
typedef typename ForceConstRef<T0>::type type0;
typedef typename ForceConstRef<T1>::type type1;
static inline bool trampoline(type0 arg0, type1 arg1, lua_State *l, int idx) {
_trampoline_start(l, idx);
pi_lua_generic_push(l, arg0);
pi_lua_generic_push(l, arg1);
return _trampoline_end(l, 2);
}
static inline void trampoline_void(type0 arg0, type1 arg1, lua_State *l, int idx) {
trampoline(arg0, arg1, l, idx);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment