diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index d993bc17..273d80cb 100644 --- a/include/nlohmann/detail/meta/type_traits.hpp +++ b/include/nlohmann/detail/meta/type_traits.hpp @@ -117,20 +117,26 @@ struct is_basic_json_nested_type std::is_same::value; }; -template -struct is_compatible_array_type +template +struct is_compatible_array_type_impl : std::false_type {}; + +template +struct is_compatible_array_type_impl < + BasicJsonType, CompatibleArrayType, + enable_if_t::value and + is_detected::value >> { - static auto constexpr value = - conjunction>, - negation>, - negation>, - negation>, - is_detected, - is_detected>::value; + static constexpr auto value = not( + is_compatible_object_type::value or + std::is_constructible::value or + is_basic_json_nested_type::value); }; +template +struct is_compatible_array_type + : is_compatible_array_type_impl {}; + template struct is_compatible_integer_type_impl : std::false_type {}; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index ce08aab8..15ff8765 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -497,20 +497,26 @@ struct is_basic_json_nested_type std::is_same::value; }; -template -struct is_compatible_array_type +template +struct is_compatible_array_type_impl : std::false_type {}; + +template +struct is_compatible_array_type_impl < + BasicJsonType, CompatibleArrayType, + enable_if_t::value and + is_detected::value >> { - static auto constexpr value = - conjunction>, - negation>, - negation>, - negation>, - is_detected, - is_detected>::value; + static constexpr auto value = not( + is_compatible_object_type::value or + std::is_constructible::value or + is_basic_json_nested_type::value); }; +template +struct is_compatible_array_type + : is_compatible_array_type_impl {}; + template struct is_compatible_integer_type_impl : std::false_type {};