💚 add fix from dd4eef3460

This commit is contained in:
Niels Lohmann 2021-11-20 11:34:05 +01:00
parent e86d8b9477
commit cf06ba8643
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 23 additions and 23 deletions

View File

@ -3555,7 +3555,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
can be thrown.,at__object_t_key_type} can be thrown.,at__object_t_key_type}
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int> = 0> detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int > = 0 >
reference at(const KeyT& key) reference at(const KeyT& key)
{ {
// at only works for objects // at only works for objects
@ -3604,7 +3604,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
at__object_t_key_type_const} at__object_t_key_type_const}
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int> = 0> detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int > = 0 >
const_reference at(const KeyT& key) const const_reference at(const KeyT& key) const
{ {
// at only works for objects // at only works for objects
@ -3749,8 +3749,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0; template KeyT added in version 3.10.0 @since version 1.0.0; template KeyT added in version 3.10.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int> = 0> detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int > = 0 >
reference operator[](KeyT&& key) reference operator[](KeyT && key)
{ {
// implicitly convert null value to an empty object // implicitly convert null value to an empty object
if (is_null()) if (is_null())
@ -3802,8 +3802,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0; template KeyT added in version 3.10.0 @since version 1.0.0; template KeyT added in version 3.10.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int> = 0> detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int > = 0 >
const_reference operator[](KeyT&& key) const const_reference operator[](KeyT && key) const
{ {
// operator[] only works for objects // operator[] only works for objects
if (JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
@ -3871,8 +3871,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// using std::is_convertible in a std::enable_if will fail when using explicit conversions // using std::is_convertible in a std::enable_if will fail when using explicit conversions
template < class KeyType, class ValueType, typename detail::enable_if_t < template < class KeyType, class ValueType, typename detail::enable_if_t <
detail::is_getable<basic_json_t, ValueType>::value detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, ValueType>::value&& detail::is_usable_as_key_type<basic_json_t, KeyType>::value, int> = 0> && !std::is_same<value_t, ValueType>::value&& detail::is_usable_as_key_type<basic_json_t, KeyType>::value, int > = 0 >
typename std::decay<ValueType>::type value(const KeyType& key, ValueType&& default_value) const typename std::decay<ValueType>::type value(const KeyType& key, ValueType && default_value) const
{ {
// at only works for objects // at only works for objects
if (JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
@ -4507,7 +4507,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 3.6.0 @since version 3.6.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& detail::is_usable_as_key_type<basic_json_t, KeyT>::value, int> = 0> !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& detail::is_usable_as_key_type<basic_json_t, KeyT>::value, int > = 0 >
bool contains(const KeyT& key) const bool contains(const KeyT& key) const
{ {
return is_object() && m_value.object->find(key) != m_value.object->end(); return is_object() && m_value.object->find(key) != m_value.object->end();

View File

@ -21122,7 +21122,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
can be thrown.,at__object_t_key_type} can be thrown.,at__object_t_key_type}
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int > = 0 >
reference at(const KeyT& key) reference at(const KeyT& key)
{ {
// at only works for objects // at only works for objects
@ -21171,7 +21171,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
at__object_t_key_type_const} at__object_t_key_type_const}
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int > = 0 >
const_reference at(const KeyT& key) const const_reference at(const KeyT& key) const
{ {
// at only works for objects // at only works for objects
@ -21316,8 +21316,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0; template KeyT added in version 3.10.0 @since version 1.0.0; template KeyT added in version 3.10.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int > = 0 >
reference operator[](KeyT&& key) reference operator[](KeyT && key)
{ {
// implicitly convert null value to an empty object // implicitly convert null value to an empty object
if (is_null()) if (is_null())
@ -21369,8 +21369,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0; template KeyT added in version 3.10.0 @since version 1.0.0; template KeyT added in version 3.10.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyT>::value&& !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int > = 0 >
const_reference operator[](KeyT&& key) const const_reference operator[](KeyT && key) const
{ {
// operator[] only works for objects // operator[] only works for objects
if (JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
@ -21438,8 +21438,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
// using std::is_convertible in a std::enable_if will fail when using explicit conversions // using std::is_convertible in a std::enable_if will fail when using explicit conversions
template < class KeyType, class ValueType, typename detail::enable_if_t < template < class KeyType, class ValueType, typename detail::enable_if_t <
detail::is_getable<basic_json_t, ValueType>::value detail::is_getable<basic_json_t, ValueType>::value
&& !std::is_same<value_t, ValueType>::value&& detail::is_usable_as_key_type<basic_json_t, KeyType>::value > ... > && !std::is_same<value_t, ValueType>::value&& detail::is_usable_as_key_type<basic_json_t, KeyType>::value, int > = 0 >
typename std::decay<ValueType>::type value(const KeyType& key, ValueType&& default_value) const typename std::decay<ValueType>::type value(const KeyType& key, ValueType && default_value) const
{ {
// at only works for objects // at only works for objects
if (JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
@ -21462,7 +21462,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@copydoc basic_json::value(const typename object_t::key_type&, const ValueType&) const @copydoc basic_json::value(const typename object_t::key_type&, const ValueType&) const
*/ */
template < class KeyType, typename detail::enable_if_t < template < class KeyType, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyType>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyType>::value, int> = 0>
string_t value(const KeyType& key, const char* default_value) const string_t value(const KeyType& key, const char* default_value) const
{ {
return value(key, string_t(default_value)); return value(key, string_t(default_value));
@ -21892,7 +21892,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0; template added in version 3.10.0 @since version 1.0.0; template added in version 3.10.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyT>::value, int> = 0>
size_type erase(const KeyT& key) size_type erase(const KeyT& key)
{ {
// this erase only works for objects // this erase only works for objects
@ -21988,7 +21988,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0 @since version 1.0.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyT>::value, int> = 0>
iterator find(const KeyT& key) iterator find(const KeyT& key)
{ {
auto result = end(); auto result = end();
@ -22006,7 +22006,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@copydoc find(const KeyT&) @copydoc find(const KeyT&)
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyT>::value, int> = 0>
const_iterator find(const KeyT& key) const const_iterator find(const KeyT& key) const
{ {
auto result = cend(); auto result = cend();
@ -22041,7 +22041,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0 @since version 1.0.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
detail::is_usable_as_key_type<basic_json_t, KeyT>::value > ... > detail::is_usable_as_key_type<basic_json_t, KeyT>::value, int> = 0>
size_type count(const KeyT& key) const size_type count(const KeyT& key) const
{ {
// return 0 for all nonobject types // return 0 for all nonobject types
@ -22074,7 +22074,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 3.6.0 @since version 3.6.0
*/ */
template < class KeyT, typename detail::enable_if_t < template < class KeyT, typename detail::enable_if_t <
!std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& detail::is_usable_as_key_type<basic_json_t, KeyT>::value > ... > !std::is_same<typename std::decay<KeyT>::type, json_pointer>::value&& detail::is_usable_as_key_type<basic_json_t, KeyT>::value, int > = 0 >
bool contains(const KeyT& key) const bool contains(const KeyT& key) const
{ {
return is_object() && m_value.object->find(key) != m_value.object->end(); return is_object() && m_value.object->find(key) != m_value.object->end();