From 295bc3a911e973c10a2a278a7811a5cc21f2ec7f Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sat, 18 Feb 2017 21:59:53 -0500 Subject: [PATCH] update single --- single/sol/sol.hpp | 61 +++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index ec1b0ba6..88c5f0ea 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2017-02-17 10:46:09.695757 UTC -// This header was generated with sol v2.15.8 (revision 37420dc) +// Generated 2017-02-19 02:59:41.608823 UTC +// This header was generated with sol v2.15.8 (revision a9cfe4b) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -8535,7 +8535,7 @@ namespace sol { namespace sol { namespace function_detail { - template + template struct overloaded_function { typedef std::tuple overload_list; typedef std::make_index_sequence indices; @@ -8557,7 +8557,7 @@ namespace sol { int operator()(lua_State* L) { auto mfx = [&](auto&&... args) { return this->call(std::forward(args)...); }; - return call_detail::overload_match(mfx, L, 1); + return call_detail::overload_match(mfx, L, 1 + start_skew); } }; } // function_detail @@ -8718,6 +8718,8 @@ namespace sol { namespace function_detail { template struct class_indicator {}; + + struct call_indicator {}; } namespace stack { template @@ -8921,13 +8923,13 @@ namespace sol { template struct pusher> { static int push(lua_State* L, overload_set&& set) { - typedef function_detail::overloaded_function F; + typedef function_detail::overloaded_function<0, Functions...> F; pusher>{}.set_fx(L, std::move(set.functions)); return 1; } static int push(lua_State* L, const overload_set& set) { - typedef function_detail::overloaded_function F; + typedef function_detail::overloaded_function<0, Functions...> F; pusher>{}.set_fx(L, set.functions); return 1; } @@ -8991,16 +8993,28 @@ namespace sol { template struct pusher> { static int push(lua_State* L, const factory_wrapper& fw) { - typedef function_detail::overloaded_function F; + typedef function_detail::overloaded_function<0, Functions...> F; pusher>{}.set_fx(L, fw.functions); return 1; } static int push(lua_State* L, factory_wrapper&& fw) { - typedef function_detail::overloaded_function F; + typedef function_detail::overloaded_function<0, Functions...> F; pusher>{}.set_fx(L, std::move(fw.functions)); return 1; } + + static int push(lua_State* L, const factory_wrapper& set, function_detail::call_indicator) { + typedef function_detail::overloaded_function<1, Functions...> F; + pusher>{}.set_fx(L, set.functions); + return 1; + } + + static int push(lua_State* L, factory_wrapper&& set, function_detail::call_indicator) { + typedef function_detail::overloaded_function<1, Functions...> F; + pusher>{}.set_fx(L, std::move(set.functions)); + return 1; + } }; template @@ -10825,19 +10839,31 @@ namespace sol { hint->second = std::move(o); } + template + void insert_prepare(std::true_type, lua_State* L, N&& n, F&& f, Args&&... args) { + object o = make_object(L, std::forward(f), function_detail::call_indicator(), std::forward(args)...); + callconstructfunc = std::move(o); + } + + template + void insert_prepare(std::false_type, lua_State* L, N&& n, F&& f, Args&&... args) { + object o = make_object(L, std::forward(f), std::forward(args)...); + insert(std::forward(n), std::move(o)); + } + template void add_member_function(std::true_type, lua_State* L, N&& n, F&& f) { - object o = make_object(L, std::forward(f), function_detail::class_indicator()); - if (std::is_same, call_construction>::value) { - callconstructfunc = std::move(o); - return; - } - insert(std::forward(n), std::move(o)); + insert_prepare(std::is_same, call_construction>(), L, std::forward(n), std::forward(f), function_detail::class_indicator()); } template void add_member_function(std::false_type, lua_State* L, N&& n, F&& f) { - object o = make_object(L, std::forward(f)); + insert_prepare(std::is_same, call_construction>(), L, std::forward(n), std::forward(f)); + } + + template >> = meta::enabler> + void add_function(lua_State* L, N&& n, F&& f) { + object o = make_object(L, as_function_reference(std::forward(f))); if (std::is_same, call_construction>::value) { callconstructfunc = std::move(o); return; @@ -10845,11 +10871,6 @@ namespace sol { insert(std::forward(n), std::move(o)); } - template >> = meta::enabler> - void add_function(lua_State* L, N&& n, F&& f) { - insert(std::forward(n), make_object(L, as_function_reference(std::forward(f)))); - } - template >> = meta::enabler> void add_function(lua_State* L, N&& n, F&& f) { add_member_function(std::is_member_pointer>(), L, std::forward(n), std::forward(f));