diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index f7fac1fb4..2e733b5d2 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -3694,9 +3694,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// @brief comparison: equal /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/ - template - requires std::is_scalar_v - bool operator==(ScalarType rhs) const noexcept + template < typename CompatibleType, + typename U = detail::uncvref_t, + detail::enable_if_t < + !detail::is_basic_json::value && detail::is_compatible_type::value, int > = 0 > + bool operator==(CompatibleType rhs) const noexcept { return *this == basic_json(rhs); }