Closed TheJCAB closed 6 months ago
include
should add
Refers to: tests/src/unit-udt.cpp:21 in 1402ca4. [](commit_id = 1402ca486594e95ae152617ecfed4770ae90603f, deletion_comment = False)
include
should add
since uint64_t is introduced.
The <cstdint>
header is already being included by json.hpp
, so this should probably be std::uint64_t
.
should add
since uint64_t is introduced.
Thanx! Looking through the codebase I saw this is typically not done. Also, I saw that std::uint64_t
and plain uint64_t
are both used in the tests indistinctly, even within the same file. So I decided to keep the change simple and minimal.
If bare uint64_t
is already being used, then you should be fine.
@gregmarr: TBH I'm considering it. It looks like
Trivia (which we have had to contend with recently 😊):
std::blah_t
types whereas blah_t
types.As for this json library: it includes both (via Hedley) so it provides both. Arguably, std::blah_t
is more strictly correct for C++, so I'll make this change if other changes are required, or if the owner asks for it.
Thanx!
Yes, please always add the std part.
@nlohmann thanx for the review. I hope I got everything proper this time.
Thanks a lot!
Thanks a lot!
My pleasure. This library is a neat piece of work, thanks!
This fixes issue #4236.
The fix is simple. In the relevant
to_json
overload, we just need to select the correct json type depending on the signedness of the enum's underlying type.The unit-udt test is also updated to cover this corner case in a way that fails without the fix.
Note that amalgamating the source was a bit of a story for me:
make pretty
but that modified 20 files, performing a significant amount of indentation changes, none of them related to my change.make amalgamate
, but that did nothing. Apparently, the make rule won't run if the single_include files have already been updated bymake pretty
. This makes sense but it can be confusing.make amalgamate
to do the work by touching the file that had the fix.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
). I decided to just let more accustomed contributors deal with this if needed.Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filessingle_include/nlohmann/json.hpp
andsingle_include/nlohmann/json_fwd.hpp
. The whole process is described here.Please don't
#ifdef
s or other means.