Skip to content

Commit ff3eaf8

Browse files
committed
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.
1 parent d33ecd3 commit ff3eaf8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/nlohmann/json.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
570570
if (t == value_t::array || t == value_t::object)
571571
{
572572
// flatten the current json_value to a heap-allocated stack
573-
std::vector<basic_json> stack;
573+
std::vector<basic_json, allocator_type> stack;
574574

575575
// move the top-level items to stack
576576
if (t == value_t::array)

single_include/nlohmann/json.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20673,7 +20673,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
2067320673
if (t == value_t::array || t == value_t::object)
2067420674
{
2067520675
// flatten the current json_value to a heap-allocated stack
20676-
std::vector<basic_json> stack;
20676+
std::vector<basic_json, allocator_type> stack;
2067720677

2067820678
// move the top-level items to stack
2067920679
if (t == value_t::array)

0 commit comments

Comments
 (0)