Function insert_child

Synopsis

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

size_t insert_child(size_t parent, size_t after)

Description

create and insert a new child of "parent". insert after the (to-be) sibling "after", which must be a child of "parent". To insert as the first child, set after to NONE

Source

Lines 745-753 in src/c4/yml/tree.hpp.

inline size_t insert_child(size_t parent, size_t after)
{
    RYML_ASSERT(parent != NONE);
    RYML_ASSERT(is_container(parent) || is_root(parent));
    RYML_ASSERT(after == NONE || has_child(parent, after));
    size_t child = _claim();
    _set_hierarchy(child, parent, after);
    return child;
}





Add Discussion as Guest

Log in