diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index dc20cc08b..f25afd2ce 100644 --- a/include/nlohmann/detail/meta/type_traits.hpp +++ b/include/nlohmann/detail/meta/type_traits.hpp @@ -399,11 +399,13 @@ struct is_constructible_tuple> : conjunction struct is_key_type { - static constexpr bool value = + static constexpr bool value = ( #if defined(JSON_HAS_CPP_17) - std::is_same::type, std::string_view>::value || + std::is_same::type, std::string_view>::value || #endif - std::is_convertible::value; + std::is_convertible::value) + && !std::is_same::value + && !std::is_same::value; }; } // namespace detail diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index c7f9e2b46..fd5a62c42 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3776,11 +3776,13 @@ struct is_constructible_tuple> : conjunction struct is_key_type { - static constexpr bool value = + static constexpr bool value = ( #if defined(JSON_HAS_CPP_17) - std::is_same::type, std::string_view>::value || + std::is_same::type, std::string_view>::value || #endif - std::is_convertible::value; + std::is_convertible::value) + && !std::is_same::value + && !std::is_same::value; }; } // namespace detail