mirror of
https://github.com/nlohmann/json.git
synced 2026-10-17 19:48:12 +00:00
Fix the indentation of the destroy comment in json.hpp (#5857)
The comment block about destroying the tree without recursion was indented one level too deep since #5835. make amalgamate reformatted it with astyle, leaving an unrelated diff in every branch. single_include is unchanged. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 parent
b41228c227
commit
c314cf8bd4
1 file changed
+24
-24
+24
-24
@@ -943,30 +943,30 @@ public:
|
|||||||
free_container(v);
|
free_container(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy the tree below top without recursing per nesting level and
|
// Destroy the tree below top without recursing per nesting level and
|
||||||
// without any heap allocation: a heap-allocated flattening
|
// without any heap allocation: a heap-allocated flattening
|
||||||
// stack (the previous implementation) can itself throw
|
// stack (the previous implementation) can itself throw
|
||||||
// bad_alloc, which would escape this noexcept destructor and
|
// bad_alloc, which would escape this noexcept destructor and
|
||||||
// terminate the program (#5135).
|
// terminate the program (#5135).
|
||||||
//
|
//
|
||||||
// Instead, walk down a chain of children (always the one
|
// Instead, walk down a chain of children (always the one
|
||||||
// walk_child() picks), reversing links as we go: cur is the
|
// walk_child() picks), reversing links as we go: cur is the
|
||||||
// container currently being emptied, and prev is its parent
|
// container currently being emptied, and prev is its parent
|
||||||
// (value_t::null when there is none). Each parent's
|
// (value_t::null when there is none). Each parent's
|
||||||
// walk_child() slot doubles as storage for that parent's own
|
// walk_child() slot doubles as storage for that parent's own
|
||||||
// parent link while we are below it, so no extra memory is
|
// parent link while we are below it, so no extra memory is
|
||||||
// needed; the parent is not modified meanwhile, so
|
// needed; the parent is not modified meanwhile, so
|
||||||
// walk_child() finds that same slot again on the way up. We
|
// walk_child() finds that same slot again on the way up. We
|
||||||
// only ever remove a child once it is a scalar or an empty
|
// only ever remove a child once it is a scalar or an empty
|
||||||
// array/object, which neither allocates nor recurses more
|
// array/object, which neither allocates nor recurses more
|
||||||
// than one level deep.
|
// than one level deep.
|
||||||
//
|
//
|
||||||
// This json_value is not itself a basic_json, so the
|
// This json_value is not itself a basic_json, so the
|
||||||
// top-level container is first moved into a local stand-in
|
// top-level container is first moved into a local stand-in
|
||||||
// ("cur"); a default-constructed basic_json has a null
|
// ("cur"); a default-constructed basic_json has a null
|
||||||
// pointer in its m_value (see data::m_value's initializer),
|
// pointer in its m_value (see data::m_value's initializer),
|
||||||
// so swapping it with *this leaves this union's own pointer
|
// so swapping it with *this leaves this union's own pointer
|
||||||
// null, and it is never looked at or freed a second time.
|
// null, and it is never looked at or freed a second time.
|
||||||
static void destroy_walk(basic_json& top) noexcept
|
static void destroy_walk(basic_json& top) noexcept
|
||||||
{
|
{
|
||||||
basic_json cur;
|
basic_json cur;
|
||||||
|
|||||||
Reference in new issue
Block a user