Fix compilation with compilers with non-totally-broken templates

This commit is contained in:
Thomas Goyne 2014-12-24 16:46:51 -08:00
parent 0a18fe6cd3
commit 44506eae56
1 changed files with 19 additions and 19 deletions

View File

@ -136,6 +136,25 @@ T& get(lua_State *L, int idx, const char *mt) {
return *static_cast<T *>(check_udata(L, idx, mt));
}
#ifdef _DEBUG
struct LuaStackcheck {
lua_State *L;
int startstack;
void check_stack(int additional);
void dump();
LuaStackcheck(lua_State *L) : L(L), startstack(lua_gettop(L)) { }
~LuaStackcheck() { check_stack(0); }
};
#else
struct LuaStackcheck {
void check_stack(int) { }
void dump() { }
LuaStackcheck(lua_State*) { }
};
#endif
struct LuaForEachBreak {};
template<typename Func>
@ -162,23 +181,4 @@ void lua_for_each(lua_State *L, Func&& func) {
/// moonscript line rewriting support
int add_stack_trace(lua_State *L);
#ifdef _DEBUG
struct LuaStackcheck {
lua_State *L;
int startstack;
void check_stack(int additional);
void dump();
LuaStackcheck(lua_State *L) : L(L), startstack(lua_gettop(L)) { }
~LuaStackcheck() { check_stack(0); }
};
#else
struct LuaStackcheck {
void check_stack(int) { }
void dump() { }
LuaStackcheck(lua_State*) { }
};
#endif
} }