mirror of
https://github.com/nlohmann/json
synced 2024-11-26 13:50:07 +00:00
Fix #1647: non-member operator== breaks enum (de)serialization.
This commit is contained in:
parent
f272ad533d
commit
27d0dfc17a
@ -2633,11 +2633,11 @@ class basic_json
|
|||||||
detail::has_non_default_from_json<basic_json_t, ValueType>::value,
|
detail::has_non_default_from_json<basic_json_t, ValueType>::value,
|
||||||
int> = 0>
|
int> = 0>
|
||||||
ValueType get() const noexcept(noexcept(
|
ValueType get() const noexcept(noexcept(
|
||||||
JSONSerializer<ValueTypeCV>::from_json(std::declval<const basic_json_t&>())))
|
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))
|
||||||
{
|
{
|
||||||
static_assert(not std::is_reference<ValueTypeCV>::value,
|
static_assert(not std::is_reference<ValueTypeCV>::value,
|
||||||
"get() cannot be used with reference types, you might want to use get_ref()");
|
"get() cannot be used with reference types, you might want to use get_ref()");
|
||||||
return JSONSerializer<ValueTypeCV>::from_json(*this);
|
return JSONSerializer<ValueType>::from_json(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -8062,7 +8062,7 @@ struct hash<nlohmann::json>
|
|||||||
/// @note: do not remove the space after '<',
|
/// @note: do not remove the space after '<',
|
||||||
/// see https://github.com/nlohmann/json/pull/679
|
/// see https://github.com/nlohmann/json/pull/679
|
||||||
template<>
|
template<>
|
||||||
struct less< ::nlohmann::detail::value_t>
|
struct less<::nlohmann::detail::value_t>
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
@brief compare two value_t enum values
|
@brief compare two value_t enum values
|
||||||
|
@ -17163,11 +17163,11 @@ class basic_json
|
|||||||
detail::has_non_default_from_json<basic_json_t, ValueType>::value,
|
detail::has_non_default_from_json<basic_json_t, ValueType>::value,
|
||||||
int> = 0>
|
int> = 0>
|
||||||
ValueType get() const noexcept(noexcept(
|
ValueType get() const noexcept(noexcept(
|
||||||
JSONSerializer<ValueTypeCV>::from_json(std::declval<const basic_json_t&>())))
|
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))
|
||||||
{
|
{
|
||||||
static_assert(not std::is_reference<ValueTypeCV>::value,
|
static_assert(not std::is_reference<ValueTypeCV>::value,
|
||||||
"get() cannot be used with reference types, you might want to use get_ref()");
|
"get() cannot be used with reference types, you might want to use get_ref()");
|
||||||
return JSONSerializer<ValueTypeCV>::from_json(*this);
|
return JSONSerializer<ValueType>::from_json(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
Reference in New Issue
Block a user