Repository navigation
Use the with_*_t aliases in tests, examples, and docs - #5787
Merged
Merged
Conversation
Replace spelled-out basic_json<...> instantiations that only change one or two template parameters with nlohmann::json::with_*_t (or ordered_json::with_*_t when the object type is ordered_map). Types that change all three number types chain with_integers_t and with_float_t. The raw basic_json<...> spelling stays where the template parameter list itself is the subject: the alias tests in unit-udt.cpp, explicit instantiations, and the ordered_json/compile-time docs. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Two test problems from #5781 broke CI on develop: CAPTURE(depth); trips clang's -Wextra-semi-stmt, and the type_error.321 messages did not account for the diagnostics path prefix. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
#5772 added functional casts that clang-tidy reports as C-style casts (google-readability-casting). Also append a char instead of a one-character string in unit-large_json. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Without JSON_DIAGNOSTICS the prefix was never modified, which clang-tidy reports (misc-const-correctness). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Contributor
nlohmann
added a commit
that referenced
this pull request
Oct 9, 2026
#5787 missed the instantiations spelled as `basic_json <` (astyle's formatting) or ending in the CustomBaseClass argument. Convert them, including the binary_t.md example pointed out in review. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #5758, as suggested in #5758 (comment). Replaces spelled-out
basic_json<...>instantiations in tests, examples, and docs withnlohmann::json::with_*_t(ordered_json::with_*_twhere the object type isordered_map). Types that change all three number types chainwith_integers_t<…>::with_float_t<…>. The raw spelling stays where the template parameter list itself is the subject (alias tests in unit-udt.cpp, explicit instantiations, ordered_json/compile-time docs).Also fixes CI on develop (7ffa409, cc02d10, 9be1ddb): #5781 was merged while its CI was cancelled and left two problems in
tests/src/unit-large_json.cpp.CAPTURE(depth);trips clang's-Wextra-semi-stmt(ci_test_clang,ci_test_standards_clang), and thetype_error.321checks did not expect the(/0/…)path prefix thatJSON_DIAGNOSTICSadds (ci_test_diagnostics). In addition, #5772 left functional casts intests/src/unit-hash.cppthat clang-tidy reports as C-style casts (ci_clang_tidy).Public API: no breaking changes. Only tests, examples, and documentation are touched.
🤖 Generated with Claude Code