Fix the issue in the relevant to_json overload.
Select the correct json type depending on the signedness of the enum's underlying type. This fixes the new checks in the unit test.
This commit is contained in:
parent
e132622794
commit
2eb72beedb
@ -320,7 +320,14 @@ template<typename BasicJsonType, typename EnumType,
|
|||||||
inline void to_json(BasicJsonType& j, EnumType e) noexcept
|
inline void to_json(BasicJsonType& j, EnumType e) noexcept
|
||||||
{
|
{
|
||||||
using underlying_type = typename std::underlying_type<EnumType>::type;
|
using underlying_type = typename std::underlying_type<EnumType>::type;
|
||||||
external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e));
|
if (std::is_unsigned<underlying_type>::value)
|
||||||
|
{
|
||||||
|
external_constructor<value_t::number_unsigned>::construct(j, static_cast<underlying_type>(e));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // JSON_DISABLE_ENUM_SERIALIZATION
|
#endif // JSON_DISABLE_ENUM_SERIALIZATION
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user