From 9624dd93e774801b49a8c9070f1b1d5841c0aeec Mon Sep 17 00:00:00 2001 From: ThePhD Date: Fri, 13 Dec 2013 20:09:51 -0500 Subject: [PATCH] VC++ Compat again. --- sol/function.hpp | 8 ++++---- sol/table.hpp | 2 +- sol/traits.hpp | 36 ++++++++++++++++++------------------ tests.cpp | 7 +++++-- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/sol/function.hpp b/sol/function.hpp index c6f47d89..f532962e 100644 --- a/sol/function.hpp +++ b/sol/function.hpp @@ -62,13 +62,13 @@ public: function& operator=(const function&) = default; template - void operator()( Args&&... args ) { - call<>(std::forward(args)... ); + void operator()(Args&&... args) { + call<>(std::forward(args)...); } template - auto operator()( types, Args&&... args ) { - return call(std::forward(args)... ); + auto operator()(types, Args&&... args) { + return call(std::forward(args)...); } template diff --git a/sol/table.hpp b/sol/table.hpp index d3de9c48..774700a1 100644 --- a/sol/table.hpp +++ b/sol/table.hpp @@ -41,7 +41,7 @@ T* get_ptr(T* val) { } // detail class table : virtual public reference { - template struct proxy; + template struct proxy; public: table() noexcept : reference() {} table(lua_State* L, int index = -1) : reference(L, index) { diff --git a/sol/traits.hpp b/sol/traits.hpp index 9b998305..26d71634 100644 --- a/sol/traits.hpp +++ b/sol/traits.hpp @@ -72,56 +72,56 @@ template struct function_traits; template -struct function_traits { - static const std::size_t arity = sizeof...( Args ); +struct function_traits { + static const std::size_t arity = sizeof...(Args); static const bool is_member_function = true; typedef std::tuple arg_tuple_type; typedef types args_type; - typedef R( T::* function_pointer_type )( Args... ); + typedef R(T::* function_pointer_type)(Args...); typedef typename std::remove_pointer::type function_type; - typedef R( *free_function_pointer_type )( Args... ); + typedef R(*free_function_pointer_type)(Args...); typedef R return_type; template using arg = typename std::tuple_element::type; }; template -struct function_traits { - static const std::size_t arity = sizeof...( Args ); +struct function_traits { + static const std::size_t arity = sizeof...(Args); static const bool is_member_function = true; typedef std::tuple arg_tuple_type; typedef types args_type; - typedef R( T::* function_pointer_type )( Args... ); + typedef R(T::* function_pointer_type)(Args...); typedef typename std::remove_pointer::type function_type; - typedef R( *free_function_pointer_type )( Args... ); + typedef R(*free_function_pointer_type)(Args...); typedef R return_type; template using arg = typename std::tuple_element::type; }; template -struct function_traits { - static const std::size_t arity = sizeof...( Args ); +struct function_traits { + static const std::size_t arity = sizeof...(Args); static const bool is_member_function = false; typedef std::tuple arg_tuple_type; typedef types args_type; - typedef R( function_type )( Args... ); - typedef R( *function_pointer_type )( Args... ); - typedef R( *free_function_pointer_type )( Args... ); + typedef R(function_type)(Args...); + typedef R(*function_pointer_type)(Args...); + typedef R(*free_function_pointer_type)(Args...); typedef R return_type; template using arg = typename std::tuple_element::type; }; template -struct function_traits { - static const std::size_t arity = sizeof...( Args ); +struct function_traits { + static const std::size_t arity = sizeof...(Args); static const bool is_member_function = false; typedef std::tuple arg_tuple_type; typedef types args_type; - typedef R( function_type )( Args... ); - typedef R( *function_pointer_type )( Args... ); - typedef R( *free_function_pointer_type )( Args... ); + typedef R(function_type)(Args...); + typedef R(*function_pointer_type)(Args...); + typedef R(*free_function_pointer_type)(Args...); typedef R return_type; template using arg = typename std::tuple_element::type; diff --git a/tests.cpp b/tests.cpp index 6e7fdc6e..7dc3debe 100644 --- a/tests.cpp +++ b/tests.cpp @@ -81,7 +81,10 @@ TEST_CASE("simple/callWithParameters", "Lua function is called with a few parame REQUIRE_NOTHROW(lua.script("function my_add(i, j, k) return i + j + k end")); auto f = lua.get("my_add"); + REQUIRE_NOTHROW(lua.script("function my_nothing(i, j, k) end")); + auto fvoid = lua.get("my_nothing"); int a; + REQUIRE_NOTHROW(fvoid(1, 2, 3)); REQUIRE_NOTHROW(a = f.call(1, 2, 3)); REQUIRE(a == 6); REQUIRE_THROWS(a = f.call(1, 2, "arf")); @@ -166,7 +169,7 @@ TEST_CASE("tables/functions_variables", "Check if tables and function calls work std::cout << "stateless lambda()" << std::endl; return "test"; } - ); + ); REQUIRE_NOTHROW(run_script(lua)); lua.get("os").set_function("fun", &free_function); @@ -184,7 +187,7 @@ TEST_CASE("tables/functions_variables", "Check if tables and function calls work std::cout << "stateless lambda()" << std::endl; return "test"; } - ); + ); REQUIRE_NOTHROW(run_script(lua)); // r-value, cannot optomize