mirror of
https://github.com/nlohmann/json
synced 2024-11-15 00:31:05 +00:00
Re-add value_type detection to distinguish string types (#3604)
* Re-add value_type detection to is_constructible_string_type trait * Add value_type detection to from_json for strings
This commit is contained in:
parent
a714381a5f
commit
a87c1885cb
@ -117,6 +117,7 @@ template <
|
||||
typename BasicJsonType, typename StringType,
|
||||
enable_if_t <
|
||||
std::is_assignable<StringType&, const typename BasicJsonType::string_t>::value
|
||||
&& is_detected_exact<typename BasicJsonType::string_t::value_type, value_type_t, StringType>::value
|
||||
&& !std::is_same<typename BasicJsonType::string_t, StringType>::value
|
||||
&& !is_json_ref<StringType>::value, int > = 0 >
|
||||
inline void from_json(const BasicJsonType& j, StringType& s)
|
||||
|
@ -363,8 +363,10 @@ struct is_constructible_string_type
|
||||
#endif
|
||||
|
||||
static constexpr auto value =
|
||||
is_constructible<laundered_type,
|
||||
typename BasicJsonType::string_t>::value;
|
||||
conjunction <
|
||||
is_constructible<laundered_type, typename BasicJsonType::string_t>,
|
||||
is_detected_exact<typename BasicJsonType::string_t::value_type,
|
||||
value_type_t, laundered_type >>::value;
|
||||
};
|
||||
|
||||
template<typename BasicJsonType, typename CompatibleArrayType, typename = void>
|
||||
|
@ -3651,8 +3651,10 @@ struct is_constructible_string_type
|
||||
#endif
|
||||
|
||||
static constexpr auto value =
|
||||
is_constructible<laundered_type,
|
||||
typename BasicJsonType::string_t>::value;
|
||||
conjunction <
|
||||
is_constructible<laundered_type, typename BasicJsonType::string_t>,
|
||||
is_detected_exact<typename BasicJsonType::string_t::value_type,
|
||||
value_type_t, laundered_type >>::value;
|
||||
};
|
||||
|
||||
template<typename BasicJsonType, typename CompatibleArrayType, typename = void>
|
||||
@ -4478,6 +4480,7 @@ template <
|
||||
typename BasicJsonType, typename StringType,
|
||||
enable_if_t <
|
||||
std::is_assignable<StringType&, const typename BasicJsonType::string_t>::value
|
||||
&& is_detected_exact<typename BasicJsonType::string_t::value_type, value_type_t, StringType>::value
|
||||
&& !std::is_same<typename BasicJsonType::string_t, StringType>::value
|
||||
&& !is_json_ref<StringType>::value, int > = 0 >
|
||||
inline void from_json(const BasicJsonType& j, StringType& s)
|
||||
|
Loading…
Reference in New Issue
Block a user