diff --git a/sol/function.hpp b/sol/function.hpp index d77bf480..f3d87485 100644 --- a/sol/function.hpp +++ b/sol/function.hpp @@ -32,10 +32,8 @@ private: template std::tuple call( types, std::size_t n ) { - typedef typename std::decay)>::type maketuple_t; - maketuple_t m = &std::make_tuple; lua_pcall( state( ), n, sizeof...( Ret ), 0 ); - return stack::pop_call( state( ), m, types() ); + return stack::pop_call( state( ), std::make_tuple, types( ) ); } template diff --git a/sol/stack.hpp b/sol/stack.hpp index c0d262ba..16b019fc 100644 --- a/sol/stack.hpp +++ b/sol/stack.hpp @@ -159,17 +159,20 @@ inline void push(lua_State* L, indices, const T& tuplen) { void(swallow{ '\0', (sol::stack::push(L, std::get(tuplen)), '\0')... }); } -template -auto ltr_pop(T&&, F&& f, types<>, Vs&&... vs) - -> decltype(f(std::forward(vs)...)) { - return f(std::forward(vs)...); +template +auto ltr_pop( lua_State*, F&& f, types<>, Vs&&... vs ) +-> decltype( f( std::forward( vs )... ) ) { + return f( std::forward( vs )... ); } - -// take head, produce value from it, pass after other values -template -auto ltr_pop(lua_State* L, F&& f, types, Vs&&... vs) --> decltype(ltr_pop(L, std::forward(f), types(), std::forward(vs)..., pop(L))) { - return ltr_pop(L, std::forward(f), types(), std::forward(vs)..., pop(L)); +template +auto ltr_pop( lua_State* L, F&& f, types, Vs&&... vs ) +-> decltype( ltr_pop( L, std::forward( f ), types<>( ), std::forward( vs )..., pop( L ) ) ) { + return ltr_pop( L, std::forward( f ), types<>( ), std::forward( vs )..., pop( L ) ); +} +template +auto ltr_pop( lua_State* L, F&& f, types, Vs&&... vs ) +-> decltype( ltr_pop( L, std::forward( f ), types( ), std::forward( vs )..., pop( L ) ) ) { + return ltr_pop( L, std::forward( f ), types( ), std::forward( vs )..., pop( L ) ); } } // detail