Commit Graph

4607 Commits

Author SHA1 Message Date
Niels Lohmann
9ea2d3e376
🐛 make SAX output locale-independent #4084 2024-11-22 10:43:59 +01:00
Niels Lohmann
8c40de9a83
🐛 make SAX output locale-independent #4084 2024-11-22 10:24:03 +01:00
Niels Lohmann
d4a06dbf2b
🐛 make SAX output locale-independent #4084 2024-11-22 09:48:33 +01:00
Niels Lohmann
8cc880f79c
🐛 make SAX output locale-independent #4084 2024-11-22 08:39:10 +01:00
Niels Lohmann
3a602db882
add test 2024-11-21 18:02:35 +01:00
Niels Lohmann
38da5b23d9
add test 2024-11-21 17:53:55 +01:00
Niels Lohmann
4346adbc05
add test 2024-11-21 16:54:11 +01:00
Niels Lohmann
143ee18285
add test 2024-11-21 15:09:49 +01:00
Niels Lohmann
8794ba17c2
add test 2024-11-21 13:55:06 +01:00
Niels Lohmann
42d7193db2
add test 2024-11-21 13:51:24 +01:00
Niels Lohmann
5425354290
🐛 make SAX output locale-independent #4084 2024-11-20 22:41:12 +01:00
Niels Lohmann
378e091795
Fix weak-vtables warning (#4500)
Some checks failed
Ubuntu / ci_test_standards_clang (17, libcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (17, libstdcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (20, libcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (20, libstdcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (23, libcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (23, libstdcxx) (push) Has been cancelled
Ubuntu / ci_cuda_example (push) Has been cancelled
Ubuntu / ci_icpc (push) Has been cancelled
Ubuntu / ci_reuse_compliance (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_api_documentation) (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_examples) (push) Has been cancelled
Windows / mingw (x64) (push) Has been cancelled
Windows / mingw (x86) (push) Has been cancelled
Windows / msvc2019 (Win32, Debug) (push) Has been cancelled
Windows / msvc2019 (Win32, Release) (push) Has been cancelled
Windows / msvc2019 (x64, Debug) (push) Has been cancelled
Windows / msvc2019 (x64, Release) (push) Has been cancelled
Windows / msvc2019_latest (push) Has been cancelled
Windows / msvc2022 (Win32, Debug) (push) Has been cancelled
Windows / msvc2022 (Win32, Release) (push) Has been cancelled
Windows / msvc2022 (x64, Debug) (push) Has been cancelled
Windows / msvc2022 (x64, Release) (push) Has been cancelled
Windows / msvc2022_latest (push) Has been cancelled
Windows / clang (11) (push) Has been cancelled
Windows / clang (12) (push) Has been cancelled
Windows / clang (13) (push) Has been cancelled
Windows / clang (14) (push) Has been cancelled
Windows / clang (15) (push) Has been cancelled
Windows / clang-cl-11 (Win32) (push) Has been cancelled
Windows / clang-cl-11 (x64) (push) Has been cancelled
* 🔧 remove warning suppression

* 🚨 fix weak-vtables warning #4087

* 🚨 suppress -Wweak-vtables warning

* 🚨 suppress -Wweak-vtables warning

*  fix test

*  fix test

*  fix test
2024-11-20 08:29:44 +01:00
jh96
1f218e1074
Possible fix for #4485 (#4487)
Some checks are pending
Ubuntu / ci_test_standards_clang (17, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (17, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (20, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (20, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (23, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (23, libstdcxx) (push) Waiting to run
Ubuntu / ci_cuda_example (push) Waiting to run
Ubuntu / ci_icpc (push) Waiting to run
Ubuntu / ci_reuse_compliance (push) Waiting to run
Ubuntu / ci_test_documentation (ci_test_api_documentation) (push) Waiting to run
Ubuntu / ci_test_documentation (ci_test_examples) (push) Waiting to run
Windows / mingw (x64) (push) Waiting to run
Windows / mingw (x86) (push) Waiting to run
Windows / msvc2019 (Win32, Debug) (push) Waiting to run
Windows / msvc2019 (Win32, Release) (push) Waiting to run
Windows / msvc2019 (x64, Debug) (push) Waiting to run
Windows / msvc2019 (x64, Release) (push) Waiting to run
Windows / msvc2019_latest (push) Waiting to run
Windows / msvc2022 (Win32, Debug) (push) Waiting to run
Windows / msvc2022 (Win32, Release) (push) Waiting to run
Windows / msvc2022 (x64, Debug) (push) Waiting to run
Windows / msvc2022 (x64, Release) (push) Waiting to run
Windows / msvc2022_latest (push) Waiting to run
Windows / clang (11) (push) Waiting to run
Windows / clang (12) (push) Waiting to run
Windows / clang (13) (push) Waiting to run
Windows / clang (14) (push) Waiting to run
Windows / clang (15) (push) Waiting to run
Windows / clang-cl-11 (Win32) (push) Waiting to run
Windows / clang-cl-11 (x64) (push) Waiting to run
* Possible fix for #4485

Throw's an exception when i is nullptr,
also added a testcase for this scenario though most likely in the wrong test file.cpp

* quick cleanup

* Fix compile issues

* moved tests around, changed exceptions, removed a possibly unneeded include

* add back include <memory> for testing something

* Ninja doesn't like not having a \n, at end of file, adding it back

* update input_adapter file to deal with empty/null file ptr.

* ran make pretty

* added test for inputadapter

* ran make amalgamate

* Update tests/src/unit-deserialization.cpp

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

* Update tests/src/unit-deserialization.cpp

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

* Update input adapters.hpp with new includes

* fix unabigious use of _, (there was a double declare)

* did the amalagamate

* rm duplicate includes

* make amalgamate again

* reorder

* amalgamate

* moved it above

* amalgamate

---------

Co-authored-by: Jordan <jordan-hoang@users.noreply.github.com>
Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
2024-11-19 13:54:04 +01:00
Niels Lohmann
64f68dc563
Suppress warnings in NLOHMANN_JSON_SERIALIZE_ENUM (#4497)
Some checks failed
Ubuntu / ci_test_standards_clang (17, libcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (17, libstdcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (20, libcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (20, libstdcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (23, libcxx) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (23, libstdcxx) (push) Has been cancelled
Ubuntu / ci_cuda_example (push) Has been cancelled
Ubuntu / ci_icpc (push) Has been cancelled
Ubuntu / ci_reuse_compliance (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_api_documentation) (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_examples) (push) Has been cancelled
Windows / mingw (x64) (push) Has been cancelled
Windows / mingw (x86) (push) Has been cancelled
Windows / msvc2019 (Win32, Debug) (push) Has been cancelled
Windows / msvc2019 (Win32, Release) (push) Has been cancelled
Windows / msvc2019 (x64, Debug) (push) Has been cancelled
Windows / msvc2019 (x64, Release) (push) Has been cancelled
Windows / msvc2019_latest (push) Has been cancelled
Windows / msvc2022 (Win32, Debug) (push) Has been cancelled
Windows / msvc2022 (Win32, Release) (push) Has been cancelled
Windows / msvc2022 (x64, Debug) (push) Has been cancelled
Windows / msvc2022 (x64, Release) (push) Has been cancelled
Windows / msvc2022_latest (push) Has been cancelled
Windows / clang (11) (push) Has been cancelled
Windows / clang (12) (push) Has been cancelled
Windows / clang (13) (push) Has been cancelled
Windows / clang (14) (push) Has been cancelled
Windows / clang (15) (push) Has been cancelled
Windows / clang-cl-11 (Win32) (push) Has been cancelled
Windows / clang-cl-11 (x64) (push) Has been cancelled
2024-11-17 14:29:27 +01:00
Niels Lohmann
1c5923e5d6
Add comment for #4494 (#4496)
Some checks are pending
Ubuntu / ci_test_standards_clang (17, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (17, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (20, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (20, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (23, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (23, libstdcxx) (push) Waiting to run
Ubuntu / ci_cuda_example (push) Waiting to run
Ubuntu / ci_icpc (push) Waiting to run
Ubuntu / ci_reuse_compliance (push) Waiting to run
Ubuntu / ci_test_documentation (ci_test_api_documentation) (push) Waiting to run
Ubuntu / ci_test_documentation (ci_test_examples) (push) Waiting to run
Windows / mingw (x64) (push) Waiting to run
Windows / mingw (x86) (push) Waiting to run
Windows / msvc2019 (Win32, Debug) (push) Waiting to run
Windows / msvc2019 (Win32, Release) (push) Waiting to run
Windows / msvc2019 (x64, Debug) (push) Waiting to run
Windows / msvc2019 (x64, Release) (push) Waiting to run
Windows / msvc2019_latest (push) Waiting to run
Windows / msvc2022 (Win32, Debug) (push) Waiting to run
Windows / msvc2022 (Win32, Release) (push) Waiting to run
Windows / msvc2022 (x64, Debug) (push) Waiting to run
Windows / msvc2022 (x64, Release) (push) Waiting to run
Windows / msvc2022_latest (push) Waiting to run
Windows / clang (11) (push) Waiting to run
Windows / clang (12) (push) Waiting to run
Windows / clang (13) (push) Waiting to run
Windows / clang (14) (push) Waiting to run
Windows / clang (15) (push) Waiting to run
Windows / clang-cl-11 (Win32) (push) Waiting to run
Windows / clang-cl-11 (x64) (push) Waiting to run
2024-11-17 07:36:05 +01:00
Niels Lohmann
e3ac5a64bf
Add test for libstdc++ (#4495)
* 👷 add test for libstdc++

* 👷 add test for libstdc++

* 💚 add fixes from #4490

* 💚 add fixes from #4490
2024-11-17 07:35:35 +01:00
Marcel
e509007df2
Remove alwayslink=True Bazel flag (#4396)
Some checks are pending
Ubuntu / ci_test_standards_gcc (23) (push) Waiting to run
Ubuntu / ci_test_standards_clang (11) (push) Waiting to run
Ubuntu / ci_test_standards_clang (14) (push) Waiting to run
Ubuntu / ci_test_standards_clang (17) (push) Waiting to run
Ubuntu / ci_test_standards_clang (20) (push) Waiting to run
Ubuntu / ci_test_standards_clang (23) (push) Waiting to run
Ubuntu / ci_cuda_example (push) Waiting to run
Ubuntu / ci_icpc (push) Waiting to run
Ubuntu / ci_reuse_compliance (push) Waiting to run
Ubuntu / ci_test_documentation (ci_test_api_documentation) (push) Waiting to run
Ubuntu / ci_test_documentation (ci_test_examples) (push) Waiting to run
Windows / mingw (x64) (push) Waiting to run
Windows / mingw (x86) (push) Waiting to run
Windows / msvc2019 (Win32, Debug) (push) Waiting to run
Windows / msvc2019 (Win32, Release) (push) Waiting to run
Windows / msvc2019 (x64, Debug) (push) Waiting to run
Windows / msvc2019 (x64, Release) (push) Waiting to run
Windows / msvc2019_latest (push) Waiting to run
Windows / msvc2022 (Win32, Debug) (push) Waiting to run
Windows / msvc2022 (Win32, Release) (push) Waiting to run
Windows / msvc2022 (x64, Debug) (push) Waiting to run
Windows / msvc2022 (x64, Release) (push) Waiting to run
Windows / msvc2022_latest (push) Waiting to run
Windows / clang (11) (push) Waiting to run
Windows / clang (12) (push) Waiting to run
Windows / clang (13) (push) Waiting to run
Windows / clang (14) (push) Waiting to run
Windows / clang (15) (push) Waiting to run
Windows / clang-cl-11 (Win32) (push) Waiting to run
Windows / clang-cl-11 (x64) (push) Waiting to run
2024-11-16 23:13:11 +01:00
Fredrik Sandhei
060414037e
feat: Rebase feature/optional to develop (#4036)
* 🚧 conversions for std::optional

* 🏁 fix <optional> inclusion

* 💚 overwork tests

* Use JSON_HAS_CPP_17 only after it has been defined

*  update tests

* 🏁 include right <optional> header

* ♻️ do not include experimental headers

* Add missing #endif after rebase

* Fix failing test

* Only define conversion to std::optional when JSON_USE_IMPLICIT_CONVERSION is disabled.

* missing endif

* Remove Wfloat-equal suppress

* amalgamate

* Move include of optional out of macro_scope; probably does not make sense to be there

* Make clang-tidy happy

* Suppress lint instead of changing to 'contains'

---------

Co-authored-by: Niels Lohmann <mail@nlohmann.me>
Co-authored-by: Markus Palonen <markus.palonen@gmail.com>
2024-11-16 17:19:33 +01:00
zjyhjqs
fd20975a94
Add CPack support (#4459) 2024-11-16 17:09:05 +01:00
Captain Crutches
fde9a86c5a
Make iterator_proxy_value a forward_iterator (#4371) (#4372)
Some checks failed
Ubuntu / ci_test_standards_gcc (23) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (11) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (14) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (17) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (20) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (23) (push) Has been cancelled
Ubuntu / ci_cuda_example (push) Has been cancelled
Ubuntu / ci_icpc (push) Has been cancelled
Ubuntu / ci_reuse_compliance (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_api_documentation) (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_examples) (push) Has been cancelled
Windows / mingw (x64) (push) Has been cancelled
Windows / mingw (x86) (push) Has been cancelled
Windows / msvc2019 (Win32, Debug) (push) Has been cancelled
Windows / msvc2019 (Win32, Release) (push) Has been cancelled
Windows / msvc2019 (x64, Debug) (push) Has been cancelled
Windows / msvc2019 (x64, Release) (push) Has been cancelled
Windows / msvc2019_latest (push) Has been cancelled
Windows / msvc2022 (Win32, Debug) (push) Has been cancelled
Windows / msvc2022 (Win32, Release) (push) Has been cancelled
Windows / msvc2022 (x64, Debug) (push) Has been cancelled
Windows / msvc2022 (x64, Release) (push) Has been cancelled
Windows / msvc2022_latest (push) Has been cancelled
Windows / clang (11) (push) Has been cancelled
Windows / clang (12) (push) Has been cancelled
Windows / clang (13) (push) Has been cancelled
Windows / clang (14) (push) Has been cancelled
Windows / clang (15) (push) Has been cancelled
Windows / clang-cl-11 (Win32) (push) Has been cancelled
Windows / clang-cl-11 (x64) (push) Has been cancelled
* Make iteration_proxy_value model forward_iterator

* Amalgamate

* Suppress tidy warning
2024-11-15 09:28:40 +01:00
Niels Lohmann
1825117e63
Another desperate try to fix the CI (#4489)
Some checks failed
Ubuntu / ci_test_standards_gcc (23) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (11) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (14) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (17) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (20) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (23) (push) Has been cancelled
Ubuntu / ci_cuda_example (push) Has been cancelled
Ubuntu / ci_icpc (push) Has been cancelled
Ubuntu / ci_reuse_compliance (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_api_documentation) (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_examples) (push) Has been cancelled
Windows / mingw (x64) (push) Has been cancelled
Windows / mingw (x86) (push) Has been cancelled
Windows / msvc2019 (Win32, Debug) (push) Has been cancelled
Windows / msvc2019 (Win32, Release) (push) Has been cancelled
Windows / msvc2019 (x64, Debug) (push) Has been cancelled
Windows / msvc2019 (x64, Release) (push) Has been cancelled
Windows / msvc2019_latest (push) Has been cancelled
Windows / msvc2022 (Win32, Debug) (push) Has been cancelled
Windows / msvc2022 (Win32, Release) (push) Has been cancelled
Windows / msvc2022 (x64, Debug) (push) Has been cancelled
Windows / msvc2022 (x64, Release) (push) Has been cancelled
Windows / msvc2022_latest (push) Has been cancelled
Windows / clang (11) (push) Has been cancelled
Windows / clang (12) (push) Has been cancelled
Windows / clang (13) (push) Has been cancelled
Windows / clang (14) (push) Has been cancelled
Windows / clang (15) (push) Has been cancelled
Windows / clang-cl-11 (Win32) (push) Has been cancelled
Windows / clang-cl-11 (x64) (push) Has been cancelled
* 🚨 fix warning

* 💚 update actions

* 🚨 fix warning

* 🚨 fix warning

* 🚨 fix warning

* 💚 update actions

* 💚 update actions

* 🚨 fix warning

* 🚨 fix warning

* 💚 update actions

* 🚨 fix warning

* 💚 update actions

* 💚 update actions

* 💚 update actions

* 🚨 fix warning

* 🚨 fix warning

* 🚨 fix warning

* 🚨 fix warning

* 💚 update actions

* 💚 update actions

* 🚨 fix warning

* 💚 update actions

* 💚 update actions

* 💚 update actions

* 💚 update actions

* 💚 update actions
2024-11-13 10:21:26 +01:00
Niels Lohmann
4a602df34e
Add lgtm explanation (#4362)
Some checks failed
Ubuntu / ci_test_standards_gcc (23) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (11) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (14) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (17) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (20) (push) Has been cancelled
Ubuntu / ci_test_standards_clang (23) (push) Has been cancelled
Ubuntu / ci_cuda_example (push) Has been cancelled
Ubuntu / ci_icpc (push) Has been cancelled
Ubuntu / ci_reuse_compliance (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_api_documentation) (push) Has been cancelled
Ubuntu / ci_test_documentation (ci_test_examples) (push) Has been cancelled
Windows / mingw (x64) (push) Has been cancelled
Windows / mingw (x86) (push) Has been cancelled
Windows / msvc2019 (Win32, Debug) (push) Has been cancelled
Windows / msvc2019 (Win32, Release) (push) Has been cancelled
Windows / msvc2019 (x64, Debug) (push) Has been cancelled
Windows / msvc2019 (x64, Release) (push) Has been cancelled
Windows / msvc2019_latest (push) Has been cancelled
Windows / msvc2022 (Win32, Debug) (push) Has been cancelled
Windows / msvc2022 (Win32, Release) (push) Has been cancelled
Windows / msvc2022 (x64, Debug) (push) Has been cancelled
Windows / msvc2022 (x64, Release) (push) Has been cancelled
Windows / msvc2022_latest (push) Has been cancelled
Windows / clang (11) (push) Has been cancelled
Windows / clang (12) (push) Has been cancelled
Windows / clang (13) (push) Has been cancelled
Windows / clang (14) (push) Has been cancelled
Windows / clang (15) (push) Has been cancelled
Windows / clang-cl-11 (Win32) (push) Has been cancelled
Windows / clang-cl-11 (x64) (push) Has been cancelled
2024-11-10 13:15:23 +01:00
Borislav Stanimirov
18ff442e63
Allow overriding the CMake target name (#4483) 2024-11-08 21:42:36 +01:00
Niccolò Iardella
aff5a31d35
Add NLOHMANN_DEFINE_DERIVED_TYPE_* macros (#4033)
* Add NLOHMANN_DEFINE_DERIVED_TYPE_* macros

* Fix with amalgamate

* Add documentation

* Fix with amalgamate

* Fix with amalgamate

---------

Co-authored-by: Niccolò Iardella <niccolo.iardella@doriansrl.it>
2024-11-08 21:41:19 +01:00
Balazs Erseki
ac8b22180d
Update CONTRIBUTING.md (#4486)
Typo in the filename.
2024-11-04 17:45:58 +01:00
thetimr
6325839776
Update is_structured.md (#4472) 2024-10-08 06:53:32 +02:00
Griffin Myers
b36f4c477c
Update natvis to reflect 3.11.3 and the current structure of basic_json (#4451)
* Update natvis Jinja template to reflect the current structure of basic_json.

In 5a1a57510a the underlying structure of
basic_json was altered to move m_type and m_value under an m_data field.
This updates the nativ template to be consistent with this change.

* Generate nlohmann_json.natvis for 3.11.3 and latest basic_json structure.
2024-09-05 20:28:24 +02:00
Nikhil Idiculla
960b763ecd
Docs: fix typos of 'whether' in operator_{gt,le,lt}.md (#4412) 2024-07-07 10:22:17 +02:00
Fallen_Breath
8c391e04fe
Docs: Fix wrong code usage in the Value access section of json_pointer.md (#4255) 2024-04-13 14:15:00 +02:00
Yuanhao Jia
01da82eae2
Fix gdb pretty printer (#4343) 2024-04-13 14:11:49 +02:00
laterlaugh
97f0bdaf9a
chore: fix some typos in comments (#4345)
chore: fix some typos in comments

Signed-off-by: laterlaugh <manziwenzhai@sina.cn>
2024-04-12 15:20:18 +02:00
Alex Prabhat Bara
c883fb0f17
Fix for incorrect function name in documentation example (#4342) 2024-04-10 18:17:47 +02:00
Leila Shcheglova
377c767aa1
Updated exception handling to catch const reference in out_of_range (#4331)
Co-authored-by: LeilaSh <leilanagieva81@gmail.com>
2024-04-08 21:12:32 +02:00
Philip Müller
16b3d841d5
Fixed an error in the Custom data source example. (#4335) 2024-04-08 21:11:25 +02:00
AniketDhemare
199dea11b1
#4307 Updated docx to 3.10.5 from 3.10.4 (#4310) 2024-03-15 13:12:21 +01:00
ss
0457de21cf
Align astyle flags in Makefile with CI (#4277)
Remove unsupported `--squeeze-lines=2` parameter

Fixes #4275
2024-01-28 20:25:22 +01:00
Niels Lohmann
c35d260c2f
Suppress Clang-Tidy warnings (#4276) 2024-01-28 14:04:07 +01:00
ss
6a064e026a
Remove broken link from CONTRIBUTING.md (#4274)
http://issuestats.com domain does not exist anymore
2024-01-28 08:55:49 +01:00
alferov
7efe875495
Update json_has_static_rtti.md (#4269) 2024-01-18 19:21:53 +01:00
Juan Carlos Arevalo Baeza
a259ecc51e
Fix to_json for enums when the enum has an unsigned underlying type. (#4237)
* Enhance the UDT unit test to expose the issue

Add a new enum type with uint64_t as the underlying type.
Use it in the overall UDT. Not strictly needed, but it helps exercise its expected usage.
Create an object of this enum type with a large value (negative if cast to int64_t).
Perform several checks on this object as converted to `json`, which fail without the fix.

* 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.

* 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`).

* Resolve CI errors and use qualified `std::uint64_t`

The fix was relying on implicit conversions in the non-taken branch.
- Ordinarily (work on a C++20 codebase) I would have used `if constexpr` here, sidestepping the issue, but that's not available on C++11 so I didn't bother.
- So instead of an `if` statement, I used a compile-time constant to select the correct overload.
- This is arguably better in this case, anyway.

I was using function-style casts for typed constants, which I consider superior for constants, but the CI checks disagree, so changed all to `static_cast`.
- For some reason, the CI checks didn't point at all of them, so I hope I caught them all myself.

Built with clang14 and all unit tests pass.

---------

Co-authored-by: Juan Carlos Arevalo Baeza (JCAB) <jcab@ntdev.microsoft.com>
2023-12-14 09:26:10 +01:00
Niels Lohmann
3780b41dd0
💰 update sponsors 2023-12-06 20:51:04 +01:00
Niels Lohmann
9cca280a4d
JSON for Modern C++ 3.11.3 (#4222) 2023-11-28 22:36:31 +01:00
Colby Haskell
1d597743d8
Fix char_traits deprecation warning (#4179) 2023-11-27 06:51:25 +01:00
Niels Lohmann
f56c6e2e30
Update documentation for the next release (#4216) 2023-11-26 15:51:19 +01:00
Vyacheslav Zhdanovskiy
360ce457f4
Add serialization-only user defined type macros (#3816) 2023-11-26 13:18:20 +01:00
Colby Haskell
5d931c59a3
Fix failing CI checks (#4215) 2023-11-25 18:04:59 +01:00
Niels Lohmann
6eab7a2b18
💚 fix documentation deploy 2023-11-01 22:16:27 +01:00
Niels Lohmann
1dfe4073e3
💚 fix documentation deploy 2023-11-01 22:09:53 +01:00
Niels Lohmann
4ffd5bd18e
💚 fix documentation deploy 2023-11-01 22:06:01 +01:00
Niels Lohmann
0261bc04d3
Fix CI (again) (#4196) 2023-11-01 21:23:55 +01:00