diff --git a/sol/types.hpp b/sol/types.hpp index 33257cf4..8fcb8301 100644 --- a/sol/types.hpp +++ b/sol/types.hpp @@ -1,4 +1,4 @@ -// sol2 +// sol2 // The MIT License (MIT) @@ -64,13 +64,13 @@ namespace sol { template , typename E = std::equal_to<>> using map_t = std::unordered_map; #endif // Boost map target - } + } // namespace usertype_detail namespace detail { #ifdef SOL_NOEXCEPT_FUNCTION_TYPE - typedef int(*lua_CFunction_noexcept)(lua_State* L) noexcept; + typedef int (*lua_CFunction_noexcept)(lua_State* L) noexcept; #else - typedef int(*lua_CFunction_noexcept)(lua_State* L); + typedef int (*lua_CFunction_noexcept)(lua_State* L); #endif // noexcept function type for lua_CFunction template @@ -115,7 +115,7 @@ namespace sol { namespace detail { struct non_lua_nil_t {}; - } + } // namespace detail struct metatable_t {}; const metatable_t metatable_key = {}; @@ -137,11 +137,11 @@ namespace sol { yielding_t& operator=(yielding_t&&) = default; template , yielding_t>>, meta::neg>>> = meta::enabler> yielding_t(Arg&& arg) - : func(std::forward(arg)) { + : func(std::forward(arg)) { } template yielding_t(Arg0&& arg0, Arg1&& arg1, Args&&... args) - : func(std::forward(arg0), std::forward(arg1), std::forward(args)...) { + : func(std::forward(arg0), std::forward(arg1), std::forward(args)...) { } }; @@ -609,8 +609,7 @@ namespace sol { }; inline const std::string& to_string(call_status c) { - static const std::array names{ { - "ok", + static const std::array names{ { "ok", "yielded", "runtime", "memory", @@ -619,8 +618,7 @@ namespace sol { "syntax", "file", "CRITICAL_EXCEPTION_FAILURE", - "CRITICAL_INDETERMINATE_STATE_FAILURE" - } }; + "CRITICAL_INDETERMINATE_STATE_FAILURE" } }; switch (c) { case call_status::ok: return names[0]; @@ -662,15 +660,13 @@ namespace sol { } inline const std::string& to_string(load_status c) { - static const std::array names{ { - "ok", + static const std::array names{ { "ok", "memory", "gc", "syntax", "file", "CRITICAL_EXCEPTION_FAILURE", - "CRITICAL_INDETERMINATE_STATE_FAILURE" - } }; + "CRITICAL_INDETERMINATE_STATE_FAILURE" } }; switch (c) { case load_status::ok: return names[0]; @@ -772,8 +768,7 @@ namespace sol { "__ipairs", "next", "__type", - "__typeinfo" - } }; + "__typeinfo" } }; return names; } @@ -830,19 +825,10 @@ namespace sol { struct is_container>::value>> : std::false_type {}; template - struct is_container> - , meta::neg>, char, wchar_t, char16_t, char32_t>> - >::value - >> : std::true_type {}; + struct is_container>, meta::neg>, char, wchar_t, char16_t, char32_t>>>::value>> : std::true_type {}; template - struct is_container> - , meta::neg>> - , meta::neg>> - >::value - >> : std::true_type {}; + struct is_container>, meta::neg>>, meta::neg>>>::value>> : std::true_type {}; } // namespace detail template @@ -996,8 +982,10 @@ namespace sol { template struct lua_type_of> : std::integral_constant {}; +#if defined(SOL_CXX17_FEATURES) && SOL_CXX17_FEATURES template struct lua_type_of> : std::integral_constant {}; +#endif // std::optional template <> struct lua_type_of : std::integral_constant {}; @@ -1129,6 +1117,10 @@ namespace sol { struct is_lua_primitive> : is_lua_primitive {}; template struct is_lua_primitive> : std::true_type {}; +#if defined(SOL_CXX17_FEATURES) && SOL_CXX17_FEATURES + template + struct is_lua_primitive> : std::true_type {}; +#endif template struct is_lua_primitive> : std::true_type {}; template