From 7acd90b6517e34c2482366d4b960b2bedafdfa89 Mon Sep 17 00:00:00 2001 From: Guillaume Racicot Date: Mon, 4 Jun 2018 11:18:19 -0400 Subject: [PATCH] Fixed check for compatible string type --- include/nlohmann/detail/conversions/from_json.hpp | 4 +--- include/nlohmann/detail/meta.hpp | 3 ++- single_include/nlohmann/json.hpp | 7 +++---- 3 files changed, 6 insertions(+), 8 deletions(-) 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) {