Operator for non equality

This commit is contained in:
Fredrik Sandhei 2024-03-19 20:57:58 +01:00
parent 65b9b38ff3
commit fc191903cc

View File

@ -3692,8 +3692,6 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
#endif
}
// template<typename ScalarType, typename std::enable_if<
// std::is_scalar<ScalarType>::value, int>::type = 0>
/// @brief comparison: equal
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
template <typename T>
@ -3703,6 +3701,15 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
return *this == basic_json(rhs);
}
/// @brief comparison: not equal
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
template <typename T>
requires detail::json_compatible_type<T, basic_json_t>::value
bool operator!=(T rhs) const noexcept
{
return *this != basic_json(rhs);
}
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
bool operator==(std::nullptr_t rhs) const noexcept
{