Some quick fixes and harmless polishes for the compat layer in state.hpp

This commit is contained in:
ThePhD 2015-07-07 00:31:50 -04:00
parent 069a209a4e
commit 6a16a5a482
3 changed files with 9 additions and 6 deletions

View File

@ -80,12 +80,12 @@ public:
} }
template<typename... Ret, typename... Args> template<typename... Ret, typename... Args>
typename return_type<Ret...>::type operator()(types<Ret...>, Args&&... args) const { ReturnType<Ret...> operator()(types<Ret...>, Args&&... args) const {
return call<Ret...>(std::forward<Args>(args)...); return call<Ret...>(std::forward<Args>(args)...);
} }
template<typename... Ret, typename... Args> template<typename... Ret, typename... Args>
typename return_type<Ret...>::type call(Args&&... args) const { ReturnType<Ret...> call(Args&&... args) const {
push(); push();
int pushcount = stack::push_args(state(), std::forward<Args>(args)...); int pushcount = stack::push_args(state(), std::forward<Args>(args)...);
auto tr = types<Ret...>(); auto tr = types<Ret...>();

View File

@ -95,12 +95,12 @@ public:
luaL_requiref(L.get(), "package", luaopen_package, 1); luaL_requiref(L.get(), "package", luaopen_package, 1);
lua_pop(L.get(), 1); lua_pop(L.get(), 1);
break; break;
case lib::coroutine:
#if SOL_LUA_VERSION > 501 #if SOL_LUA_VERSION > 501
case lib::coroutine:
luaL_requiref(L.get(), "coroutine", luaopen_coroutine, 1); luaL_requiref(L.get(), "coroutine", luaopen_coroutine, 1);
lua_pop(L.get(), 1); lua_pop(L.get(), 1);
#endif // Lua 5.2+ only
break; break;
#endif // Lua 5.2+ only
case lib::string: case lib::string:
luaL_requiref(L.get(), "string", luaopen_string, 1); luaL_requiref(L.get(), "string", luaopen_string, 1);
lua_pop(L.get(), 1); lua_pop(L.get(), 1);

View File

@ -118,10 +118,13 @@ struct return_type<T> {
}; };
template<> template<>
struct return_type<> : types<>{ struct return_type<> {
typedef void type; typedef void type;
}; };
template <typename... Tn>
using ReturnType = typename return_type<Tn...>::type;
namespace detail { namespace detail {
template<typename T, bool isclass = std::is_class<Unqualified<T>>::value> template<typename T, bool isclass = std::is_class<Unqualified<T>>::value>