diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index b066b2b4..b71bb0ec 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -75,9 +75,7 @@ template < enable_if_t < is_compatible_string_type::value and not std::is_same::value and - std::is_constructible < - BasicJsonType, typename CompatibleStringType::value_type >::value, + CompatibleStringType>::value, int > = 0 > void from_json(const BasicJsonType& j, CompatibleStringType& s) { diff --git a/include/nlohmann/detail/meta.hpp b/include/nlohmann/detail/meta.hpp index 780efba8..50200304 100644 --- a/include/nlohmann/detail/meta.hpp +++ b/include/nlohmann/detail/meta.hpp @@ -127,7 +127,8 @@ template struct is_compatible_string_type_impl { static constexpr auto value = - std::is_same::value; + std::is_same::value and + std::is_constructible::value; }; template diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index a886cc9e..555aa1de 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -360,7 +360,8 @@ template struct is_compatible_string_type_impl { static constexpr auto value = - std::is_same::value; + std::is_same::value and + std::is_constructible::value; }; template @@ -1001,9 +1002,7 @@ template < enable_if_t < is_compatible_string_type::value and not std::is_same::value and - std::is_constructible < - BasicJsonType, typename CompatibleStringType::value_type >::value, + CompatibleStringType>::value, int > = 0 > void from_json(const BasicJsonType& j, CompatibleStringType& s) {