Fixed check for compatible string type

This commit is contained in:
Guillaume Racicot 2018-06-04 11:18:19 -04:00
parent 4778c02ab5
commit 7acd90b651
3 changed files with 6 additions and 8 deletions

View file

@ -75,9 +75,7 @@ template <
enable_if_t <
is_compatible_string_type<BasicJsonType, CompatibleStringType>::value and
not std::is_same<typename BasicJsonType::string_t,
CompatibleStringType>::value and
std::is_constructible <
BasicJsonType, typename CompatibleStringType::value_type >::value,
CompatibleStringType>::value,
int > = 0 >
void from_json(const BasicJsonType& j, CompatibleStringType& s)
{

View file

@ -127,7 +127,8 @@ template<class RealType, class CompatibleStringType>
struct is_compatible_string_type_impl<true, RealType, CompatibleStringType>
{
static constexpr auto value =
std::is_same<typename RealType::value_type, typename CompatibleStringType::value_type>::value;
std::is_same<typename RealType::value_type, typename CompatibleStringType::value_type>::value and
std::is_constructible<RealType, CompatibleStringType>::value;
};
template<class BasicJsonType, class CompatibleObjectType>

View file

@ -360,7 +360,8 @@ template<class RealType, class CompatibleStringType>
struct is_compatible_string_type_impl<true, RealType, CompatibleStringType>
{
static constexpr auto value =
std::is_same<typename RealType::value_type, typename CompatibleStringType::value_type>::value;
std::is_same<typename RealType::value_type, typename CompatibleStringType::value_type>::value and
std::is_constructible<RealType, CompatibleStringType>::value;
};
template<class BasicJsonType, class CompatibleObjectType>
@ -1001,9 +1002,7 @@ template <
enable_if_t <
is_compatible_string_type<BasicJsonType, CompatibleStringType>::value and
not std::is_same<typename BasicJsonType::string_t,
CompatibleStringType>::value and
std::is_constructible <
BasicJsonType, typename CompatibleStringType::value_type >::value,
CompatibleStringType>::value,
int > = 0 >
void from_json(const BasicJsonType& j, CompatibleStringType& s)
{