refactor is_compatible_string_type

This commit is contained in:
Théo DELRIEU 2018-09-05 16:42:55 +02:00
parent e84195ab7b
commit 924e95c6e8
No known key found for this signature in database
GPG key ID: A5A505438C20539A
2 changed files with 20 additions and 24 deletions

View file

@ -90,25 +90,23 @@ template <typename BasicJsonType, typename CompatibleObjectType>
struct is_compatible_object_type struct is_compatible_object_type
: is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {}; : is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {};
template<bool B, class RealType, class CompatibleStringType> template <typename BasicJsonType, typename CompatibleStringType,
typename = void>
struct is_compatible_string_type_impl : std::false_type {}; struct is_compatible_string_type_impl : std::false_type {};
template<class RealType, class CompatibleStringType> template <typename BasicJsonType, typename CompatibleStringType>
struct is_compatible_string_type_impl<true, RealType, CompatibleStringType> struct is_compatible_string_type_impl <
BasicJsonType, CompatibleStringType,
enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
value_type_t, CompatibleStringType>::value >>
{ {
static constexpr auto value = static constexpr auto value =
std::is_same<typename RealType::value_type, typename CompatibleStringType::value_type>::value and std::is_constructible<typename BasicJsonType::string_t, CompatibleStringType>::value;
std::is_constructible<RealType, CompatibleStringType>::value;
}; };
template<class BasicJsonType, class CompatibleStringType> template <typename BasicJsonType, typename CompatibleStringType>
struct is_compatible_string_type struct is_compatible_string_type
{ : is_compatible_string_type_impl<BasicJsonType, CompatibleStringType> {};
static auto constexpr value = is_compatible_string_type_impl <
conjunction<negation<std::is_same<void, CompatibleStringType>>,
is_detected<value_type_t, CompatibleStringType>>::value,
typename BasicJsonType::string_t, CompatibleStringType >::value;
};
template<typename BasicJsonType, typename T> template<typename BasicJsonType, typename T>
struct is_basic_json_nested_type struct is_basic_json_nested_type

View file

@ -470,25 +470,23 @@ template <typename BasicJsonType, typename CompatibleObjectType>
struct is_compatible_object_type struct is_compatible_object_type
: is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {}; : is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {};
template<bool B, class RealType, class CompatibleStringType> template <typename BasicJsonType, typename CompatibleStringType,
typename = void>
struct is_compatible_string_type_impl : std::false_type {}; struct is_compatible_string_type_impl : std::false_type {};
template<class RealType, class CompatibleStringType> template <typename BasicJsonType, typename CompatibleStringType>
struct is_compatible_string_type_impl<true, RealType, CompatibleStringType> struct is_compatible_string_type_impl <
BasicJsonType, CompatibleStringType,
enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
value_type_t, CompatibleStringType>::value >>
{ {
static constexpr auto value = static constexpr auto value =
std::is_same<typename RealType::value_type, typename CompatibleStringType::value_type>::value and std::is_constructible<typename BasicJsonType::string_t, CompatibleStringType>::value;
std::is_constructible<RealType, CompatibleStringType>::value;
}; };
template<class BasicJsonType, class CompatibleStringType> template <typename BasicJsonType, typename CompatibleStringType>
struct is_compatible_string_type struct is_compatible_string_type
{ : is_compatible_string_type_impl<BasicJsonType, CompatibleStringType> {};
static auto constexpr value = is_compatible_string_type_impl <
conjunction<negation<std::is_same<void, CompatibleStringType>>,
is_detected<value_type_t, CompatibleStringType>>::value,
typename BasicJsonType::string_t, CompatibleStringType >::value;
};
template<typename BasicJsonType, typename T> template<typename BasicJsonType, typename T>
struct is_basic_json_nested_type struct is_basic_json_nested_type