Files
json/include/nlohmann
Niels LohmannandClaude Opus 5 ee211df64a Only reserve array capacity if the array type supports it
PR #5476 added an unconditional `reserve()` call to the `start_array()`
implementations of both `json_sax_dom_parser` and
`json_sax_dom_callback_parser`. `ArrayType` is a template parameter of
`basic_json`, however, and is not required to have a `reserve()` member
function: instantiating either parser for, e.g., `basic_json<std::map,
std::deque>` fails to compile, which breaks every use of `parse()` and
the binary readers for such a type.

Move the capped reservation into a `reserve_array()` helper that selects
a no-op overload through `priority_tag` when `ArrayType` has no
`reserve()`, mirroring `from_json_object_reserve()`. `std::vector` array
types keep reserving as before, and the 16384-element cap is unchanged.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 18:02:01 +02:00
..
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00
2026-01-01 20:00:39 +01:00