⚗️ exclude iterators from KeyType

This commit is contained in:
Niels Lohmann 2021-03-30 10:14:26 +02:00
parent 69d74d4e3d
commit 418fdbab62
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 10 additions and 6 deletions

View File

@ -399,11 +399,13 @@ struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<std::is_con
template<typename BasicJsonType, typename KeyType>
struct is_key_type
{
static constexpr bool value =
static constexpr bool value = (
#if defined(JSON_HAS_CPP_17)
std::is_same<typename std::decay<KeyType>::type, std::string_view>::value ||
std::is_same<typename std::decay<KeyType>::type, std::string_view>::value ||
#endif
std::is_convertible<KeyType, typename BasicJsonType::object_t::key_type>::value;
std::is_convertible<KeyType, typename BasicJsonType::object_t::key_type>::value)
&& !std::is_same<KeyType, typename BasicJsonType::iterator>::value
&& !std::is_same<KeyType, typename BasicJsonType::const_iterator>::value;
};
} // namespace detail

View File

@ -3776,11 +3776,13 @@ struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<std::is_con
template<typename BasicJsonType, typename KeyType>
struct is_key_type
{
static constexpr bool value =
static constexpr bool value = (
#if defined(JSON_HAS_CPP_17)
std::is_same<typename std::decay<KeyType>::type, std::string_view>::value ||
std::is_same<typename std::decay<KeyType>::type, std::string_view>::value ||
#endif
std::is_convertible<KeyType, typename BasicJsonType::object_t::key_type>::value;
std::is_convertible<KeyType, typename BasicJsonType::object_t::key_type>::value)
&& !std::is_same<KeyType, typename BasicJsonType::iterator>::value
&& !std::is_same<KeyType, typename BasicJsonType::const_iterator>::value;
};
} // namespace detail