mirror of
https://github.com/nlohmann/json.git
synced 2026-09-01 14:07:14 +00:00
get_elements() only receives a raw pointer and cannot know the size of its destination, so the destination-size guarantee is asserted at the caller that owns the buffer: after resizing `result`, assert it has room for `wanted` bytes at `old_size`. Together with the `copied <= wanted` assert at the memcpy, this makes the "destination is large enough" invariant explicit on both sides of the call. Signed-off-by: Niels Lohmann <mail@nlohmann.me> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>