From cf06ba8643121742fe3a7ef3e1f52f4b9f933695 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 20 Nov 2021 11:34:05 +0100 Subject: [PATCH] :green_heart: add fix from https://github.com/Minipeps/json/commit/dd4eef346036f3865e447e883166950c7578d022 --- include/nlohmann/json.hpp | 18 +++++++++--------- single_include/nlohmann/json.hpp | 28 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index a5057da18..e92affe80 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -3555,7 +3555,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec can be thrown.,at__object_t_key_type} */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int> = 0> + detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int > = 0 > reference at(const KeyT& key) { // 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} */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int> = 0> + detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int > = 0 > const_reference at(const KeyT& key) const { // 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 */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int> = 0> - reference operator[](KeyT&& key) + detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int > = 0 > + reference operator[](KeyT && key) { // implicitly convert null value to an empty object 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 */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int> = 0> - const_reference operator[](KeyT&& key) const + detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int > = 0 > + const_reference operator[](KeyT && key) const { // operator[] only works for objects 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 template < class KeyType, class ValueType, typename detail::enable_if_t < detail::is_getable::value - && !std::is_same::value&& detail::is_usable_as_key_type::value, int> = 0> - typename std::decay::type value(const KeyType& key, ValueType&& default_value) const + && !std::is_same::value&& detail::is_usable_as_key_type::value, int > = 0 > + typename std::decay::type value(const KeyType& key, ValueType && default_value) const { // at only works for objects 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 */ template < class KeyT, typename detail::enable_if_t < - !std::is_same::type, json_pointer>::value&& detail::is_usable_as_key_type::value, int> = 0> + !std::is_same::type, json_pointer>::value&& detail::is_usable_as_key_type::value, int > = 0 > bool contains(const KeyT& key) const { return is_object() && m_value.object->find(key) != m_value.object->end(); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 923bcbf46..0ccdcd70c 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -21122,7 +21122,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec can be thrown.,at__object_t_key_type} */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value > ... > + detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int > = 0 > reference at(const KeyT& key) { // 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} */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value > ... > + detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int > = 0 > const_reference at(const KeyT& key) const { // 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 */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value > ... > - reference operator[](KeyT&& key) + detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int > = 0 > + reference operator[](KeyT && key) { // implicitly convert null value to an empty object 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 */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value > ... > - const_reference operator[](KeyT&& key) const + detail::is_usable_as_key_type::value&& !std::is_same::type, json_pointer>::value, int > = 0 > + const_reference operator[](KeyT && key) const { // operator[] only works for objects 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 template < class KeyType, class ValueType, typename detail::enable_if_t < detail::is_getable::value - && !std::is_same::value&& detail::is_usable_as_key_type::value > ... > - typename std::decay::type value(const KeyType& key, ValueType&& default_value) const + && !std::is_same::value&& detail::is_usable_as_key_type::value, int > = 0 > + typename std::decay::type value(const KeyType& key, ValueType && default_value) const { // at only works for objects 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 */ template < class KeyType, typename detail::enable_if_t < - detail::is_usable_as_key_type::value > ... > + detail::is_usable_as_key_type::value, int> = 0> string_t value(const KeyType& key, const char* default_value) const { 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 */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value > ... > + detail::is_usable_as_key_type::value, int> = 0> size_type erase(const KeyT& key) { // 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 */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value > ... > + detail::is_usable_as_key_type::value, int> = 0> iterator find(const KeyT& key) { auto result = end(); @@ -22006,7 +22006,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec @copydoc find(const KeyT&) */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value > ... > + detail::is_usable_as_key_type::value, int> = 0> const_iterator find(const KeyT& key) const { auto result = cend(); @@ -22041,7 +22041,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec @since version 1.0.0 */ template < class KeyT, typename detail::enable_if_t < - detail::is_usable_as_key_type::value > ... > + detail::is_usable_as_key_type::value, int> = 0> size_type count(const KeyT& key) const { // 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 */ template < class KeyT, typename detail::enable_if_t < - !std::is_same::type, json_pointer>::value&& detail::is_usable_as_key_type::value > ... > + !std::is_same::type, json_pointer>::value&& detail::is_usable_as_key_type::value, int > = 0 > bool contains(const KeyT& key) const { return is_object() && m_value.object->find(key) != m_value.object->end();