Skip to content

Commit 1402ca4

Browse files
committed
Add the fix to the single_include
I ran `make pretty` but that modified 20 files, performing a significant amount of indentation changes, none of them related to my change. I ran `make amalgamate`, but that did nothing. Apparently, the make rule won't run if the single_include files have already been updated by `make pretty`. I forced `make amalgamate` to do the work by touching the file with the fix. I then decided to keep just the minimal needed change: the addition of the fix to the single_include file. I just am not conversant enough in Linux to know whether I installed astyle correctly (had to clone the source from a beta branch and build, in order to get support for `--squeeze-lines`).
1 parent 2eb72be commit 1402ca4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

single_include/nlohmann/json.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5697,7 +5697,14 @@ template<typename BasicJsonType, typename EnumType,
56975697
inline void to_json(BasicJsonType& j, EnumType e) noexcept
56985698
{
56995699
using underlying_type = typename std::underlying_type<EnumType>::type;
5700-
external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e));
5700+
if (std::is_unsigned<underlying_type>::value)
5701+
{
5702+
external_constructor<value_t::number_unsigned>::construct(j, static_cast<underlying_type>(e));
5703+
}
5704+
else
5705+
{
5706+
external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e));
5707+
}
57015708
}
57025709
#endif // JSON_DISABLE_ENUM_SERIALIZATION
57035710

0 commit comments

Comments
 (0)