Replace scalar type comparison restriction with one extended for compatible types.
This commit is contained in:
parent
edffad036d
commit
d21abfc35e
@ -3694,9 +3694,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
|||||||
|
|
||||||
/// @brief comparison: equal
|
/// @brief comparison: equal
|
||||||
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
|
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
|
||||||
template<typename ScalarType>
|
template < typename CompatibleType,
|
||||||
requires std::is_scalar_v<ScalarType>
|
typename U = detail::uncvref_t<CompatibleType>,
|
||||||
bool operator==(ScalarType rhs) const noexcept
|
detail::enable_if_t <
|
||||||
|
!detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value, int > = 0 >
|
||||||
|
bool operator==(CompatibleType rhs) const noexcept
|
||||||
{
|
{
|
||||||
return *this == basic_json(rhs);
|
return *this == basic_json(rhs);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user