From 83f702be12318cd4cead53b25d616e8b89718f19 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Thu, 4 Apr 2019 21:33:32 -0400 Subject: [PATCH] Funny, people push state_view and stuff into the system and everything goes to hell and high water... --- include/sol/stack_core.hpp | 2 +- include/sol/types.hpp | 17 ++++++++++------- include/sol/usertype_container.hpp | 4 ++++ include/sol/usertype_core.hpp | 2 ++ single/include/sol/forward.hpp | 4 ++-- single/include/sol/sol.hpp | 29 +++++++++++++++++++---------- 6 files changed, 38 insertions(+), 20 deletions(-) diff --git a/include/sol/stack_core.hpp b/include/sol/stack_core.hpp index 34370dc6..e562d9f6 100644 --- a/include/sol/stack_core.hpp +++ b/include/sol/stack_core.hpp @@ -1390,7 +1390,7 @@ namespace sol { return stack::push(L, op(detail::ptr(l), detail::ptr(r))); } else { - if constexpr (std::is_same_v, Op> // cf-hack + if constexpr (std::is_same_v, Op> // clang-format hack || std::is_same_v, Op> // || std::is_same_v, Op>) { // if (detail::ptr(l) == detail::ptr(r)) { diff --git a/include/sol/types.hpp b/include/sol/types.hpp index 472dce3d..5f48ef04 100644 --- a/include/sol/types.hpp +++ b/include/sol/types.hpp @@ -945,8 +945,11 @@ namespace sol { struct is_variadic_arguments : std::is_same {}; template - struct is_container : std::integral_constant && !meta::is_string_like_v && !meta::is_string_literal_array_v && !is_transparent_argument_v && !is_lua_reference_v && (meta::has_begin_end_v || std::is_array_v)> {}; - + struct is_container + : std::integral_constant && !std::is_same_v && !meta::is_initializer_list_v && !meta::is_string_like_v && !meta::is_string_literal_array_v && !is_transparent_argument_v && !is_lua_reference_v && (meta::has_begin_end_v || std::is_array_v)> { + }; + template constexpr inline bool is_container_v = is_container::value; @@ -1157,10 +1160,8 @@ namespace sol { #endif // SOL_CXX17_FEATURES template - struct lua_type_of, std::enable_if_t<::sol::is_container::value>> : std::integral_constant {}; - - template - struct lua_type_of, std::enable_if_t::value>> : lua_type_of {}; + struct lua_type_of> + : meta::conditional_t<::sol::is_container::value, std::integral_constant, lua_type_of> {}; template class V, typename... Args> struct accumulate : std::integral_constant {}; @@ -1332,7 +1333,9 @@ namespace sol { struct is_environment : std::integral_constant::value || is_table::value> {}; template - struct is_automagical : meta::neg>> {}; + struct is_automagical + : std::integral_constant> && !std::is_same_v, state> && !std::is_same_v, state_view>> {}; template inline type type_of() { diff --git a/include/sol/usertype_container.hpp b/include/sol/usertype_container.hpp index ba7a6c9f..f8ac2303 100644 --- a/include/sol/usertype_container.hpp +++ b/include/sol/usertype_container.hpp @@ -419,6 +419,10 @@ namespace sol { return luaL_error(L, "sol: cannot call 'find' on type '%s': it is not recognized as a container", detail::demangle().c_str()); } + static int index_of(lua_State* L) { + return luaL_error(L, "sol: cannot call 'index_of' on type '%s': it is not recognized as a container", detail::demangle().c_str()); + } + static int size(lua_State* L) { return luaL_error(L, "sol: cannot call 'end' on type '%s': it is not recognized as a container", detail::demangle().c_str()); } diff --git a/include/sol/usertype_core.hpp b/include/sol/usertype_core.hpp index cebe6e76..cb57a041 100644 --- a/include/sol/usertype_core.hpp +++ b/include/sol/usertype_core.hpp @@ -118,6 +118,8 @@ namespace sol { template inline void insert_default_registrations(IFx&& ifx, Fx&& fx) { + (void)ifx; + (void)fx; if constexpr (is_automagical::value) { if (fx(meta_function::less_than)) { if constexpr (meta::supports_op_less::value) { diff --git a/single/include/sol/forward.hpp b/single/include/sol/forward.hpp index 6707d4ac..03ae9dfa 100644 --- a/single/include/sol/forward.hpp +++ b/single/include/sol/forward.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 2019-04-04 13:37:22.568531 UTC -// This header was generated with sol v3.0.1-beta2 (revision 39e18b4) +// Generated 2019-04-05 01:32:37.193318 UTC +// This header was generated with sol v3.0.1-beta2 (revision 7e71897) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP diff --git a/single/include/sol/sol.hpp b/single/include/sol/sol.hpp index aaaa5be3..50c2edc6 100644 --- a/single/include/sol/sol.hpp +++ b/single/include/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 2019-04-04 13:37:22.264979 UTC -// This header was generated with sol v3.0.1-beta2 (revision 39e18b4) +// Generated 2019-04-05 01:32:35.413302 UTC +// This header was generated with sol v3.0.1-beta2 (revision 7e71897) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -7073,8 +7073,11 @@ namespace sol { struct is_variadic_arguments : std::is_same {}; template - struct is_container : std::integral_constant && !meta::is_string_like_v && !meta::is_string_literal_array_v && !is_transparent_argument_v && !is_lua_reference_v && (meta::has_begin_end_v || std::is_array_v)> {}; - + struct is_container + : std::integral_constant && !std::is_same_v && !meta::is_initializer_list_v && !meta::is_string_like_v && !meta::is_string_literal_array_v && !is_transparent_argument_v && !is_lua_reference_v && (meta::has_begin_end_v || std::is_array_v)> { + }; + template constexpr inline bool is_container_v = is_container::value; @@ -7285,10 +7288,8 @@ namespace sol { #endif // SOL_CXX17_FEATURES template - struct lua_type_of, std::enable_if_t<::sol::is_container::value>> : std::integral_constant {}; - - template - struct lua_type_of, std::enable_if_t::value>> : lua_type_of {}; + struct lua_type_of> + : meta::conditional_t<::sol::is_container::value, std::integral_constant, lua_type_of> {}; template class V, typename... Args> struct accumulate : std::integral_constant {}; @@ -7460,7 +7461,9 @@ namespace sol { struct is_environment : std::integral_constant::value || is_table::value> {}; template - struct is_automagical : meta::neg>> {}; + struct is_automagical + : std::integral_constant> && !std::is_same_v, state> && !std::is_same_v, state_view>> {}; template inline type type_of() { @@ -10391,7 +10394,7 @@ namespace sol { return stack::push(L, op(detail::ptr(l), detail::ptr(r))); } else { - if constexpr (std::is_same_v, Op> // cf-hack + if constexpr (std::is_same_v, Op> // clang-format hack || std::is_same_v, Op> // || std::is_same_v, Op>) { // if (detail::ptr(l) == detail::ptr(r)) { @@ -18910,6 +18913,10 @@ namespace sol { return luaL_error(L, "sol: cannot call 'find' on type '%s': it is not recognized as a container", detail::demangle().c_str()); } + static int index_of(lua_State* L) { + return luaL_error(L, "sol: cannot call 'index_of' on type '%s': it is not recognized as a container", detail::demangle().c_str()); + } + static int size(lua_State* L) { return luaL_error(L, "sol: cannot call 'end' on type '%s': it is not recognized as a container", detail::demangle().c_str()); } @@ -20417,6 +20424,8 @@ namespace sol { template inline void insert_default_registrations(IFx&& ifx, Fx&& fx) { + (void)ifx; + (void)fx; if constexpr (is_automagical::value) { if (fx(meta_function::less_than)) { if constexpr (meta::supports_op_less::value) {