Use the provided allocator in destroy() (#4842)

Uses the provided allocator to allocate the stack used to avoid
recursion in the destroy() implementation used by ~basic_json.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Vesko Karaganev
2026-10-04 18:00:21 +02:00
committed by Niels Lohmann
parent 8c1f60a45e
commit 13d555538b
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -627,7 +627,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
if (t == value_t::array || t == value_t::object)
{
// flatten the current json_value to a heap-allocated stack
std::vector<basic_json> stack;
std::vector<basic_json, allocator_type> stack;
// move the top-level items to stack
if (t == value_t::array)
+1 -1
View File
@@ -27749,7 +27749,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
if (t == value_t::array || t == value_t::object)
{
// flatten the current json_value to a heap-allocated stack
std::vector<basic_json> stack;
std::vector<basic_json, allocator_type> stack;
// move the top-level items to stack
if (t == value_t::array)