Function remove_children

Synopsis

#include <src/c4/yml/tree.hpp>

void remove_children(size_t node)

Description

remove all the node's children, but keep the node itself

Source

Lines 757-770 in src/c4/yml/tree.hpp.

void remove_children(size_t node)
{
    RYML_ASSERT(get(node) != nullptr);
    size_t ich = get(node)->m_first_child;
    while(ich != NONE)
    {
        remove_children(ich);
        RYML_ASSERT(get(ich) != nullptr);
        size_t next = get(ich)->m_next_sibling;
        _release(ich);
        if(ich == get(node)->m_last_child) break;
        ich = next;
    }
}





Add Discussion as Guest

Log in