From 0c9adb13f535ae15eaa2e5cfd34324d835eff610 Mon Sep 17 00:00:00 2001 From: Fredrik Sandhei Date: Thu, 29 Feb 2024 21:24:01 +0100 Subject: [PATCH] Use SFINAE instead of 'requires' clause because of cppcheck. --- include/nlohmann/json.hpp | 6 ++++-- single_include/nlohmann/json.hpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 2e116f104..ae5c0a552 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -3692,10 +3692,12 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec #endif } + // template::value, int>::type = 0> /// @brief comparison: equal /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/ - template - requires detail::json_compatible_type::value + template ::value, int>::type = 0> bool operator==(T rhs) const noexcept { return *this == basic_json(rhs); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 8ef520dc0..44c7f5f3f 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -22912,10 +22912,12 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec #endif } + // template::value, int>::type = 0> /// @brief comparison: equal /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/ - template - requires detail::json_compatible_type::value + template ::value, int>::type = 0> bool operator==(T rhs) const noexcept { return *this == basic_json(rhs);