diff --git a/include/sol/types.hpp b/include/sol/types.hpp index 4976241f..722cf834 100644 --- a/include/sol/types.hpp +++ b/include/sol/types.hpp @@ -51,6 +51,21 @@ #endif // Using Boost namespace sol { + namespace usertype_detail { +#if defined(SOL_USE_BOOST) +#if defined(SOL_CXX17_FEATURES) + template , typename E = std::equal_to<>> + using map_t = boost::unordered_map; +#else + template , typename E = std::equal_to<>> + using map_t = boost::unordered_map; +#endif // C++17 or not, WITH boost +#else + 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; @@ -79,14 +94,14 @@ namespace sol { }; struct unchecked_t {}; - const unchecked_t unchecked = unchecked_t {}; + const unchecked_t unchecked = unchecked_t{}; struct yield_tag_t {}; - const yield_tag_t yield_tag = yield_tag_t {}; + const yield_tag_t yield_tag = yield_tag_t{}; } // namespace detail struct lua_nil_t {}; - const lua_nil_t lua_nil {}; + const lua_nil_t lua_nil{}; inline bool operator==(lua_nil_t, lua_nil_t) { return true; } @@ -95,7 +110,7 @@ namespace sol { } typedef lua_nil_t nil_t; #if !defined(SOL_NO_NIL) || (SOL_NO_NIL == 0) - const nil_t nil {}; + const nil_t nil{}; #endif namespace detail { @@ -596,7 +611,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", @@ -647,7 +662,7 @@ 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", @@ -674,7 +689,7 @@ namespace sol { } inline const std::string& to_string(load_mode c) { - static const std::array names { { + static const std::array names{ { "bt", "t", "b", @@ -982,8 +997,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 {}; @@ -1124,6 +1141,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 @@ -1241,7 +1262,7 @@ namespace sol { struct add_destructor_tag {}; struct check_destructor_tag {}; struct verified_tag { - } const verified {}; + } const verified{}; } // namespace detail struct automagic_enrollments {