Function operator[]

Summary

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

(1) NodeRef operator[](csubstr const &k)

(2) NodeRef operator[](size_t pos)

(3) NodeRef const operator[](csubstr const &k) const

(4) NodeRef const operator[](size_t pos) const

Function overload

Synopsis

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

NodeRef operator[](csubstr const &k)

Description

O(num_children)

Source

Lines 274-281 in src/c4/yml/node.hpp.

NodeRef operator[] (csubstr const& k)
{
    RYML_ASSERT( ! is_seed());
    RYML_ASSERT(valid());
    size_t ch = m_tree->find_child(m_id, k);
    NodeRef r = ch != NONE ? NodeRef(m_tree, ch) : NodeRef(m_tree, m_id, k);
    return r;
}

Synopsis

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

NodeRef operator[](size_t pos)

Description

O(num_children)

Source

Lines 284-291 in src/c4/yml/node.hpp.

NodeRef operator[] (size_t pos)
{
    RYML_ASSERT( ! is_seed());
    RYML_ASSERT(valid());
    size_t ch = m_tree->child(m_id, pos);
    NodeRef r = ch != NONE ? NodeRef(m_tree, ch) : NodeRef(m_tree, m_id, pos);
    return r;
}

Synopsis

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

NodeRef const operator[](csubstr const &k) const

Description

O(num_children)

Source

Lines 296-304 in src/c4/yml/node.hpp.

NodeRef const operator[] (csubstr const& k) const
{
    RYML_ASSERT( ! is_seed());
    RYML_ASSERT(valid());
    size_t ch = m_tree->find_child(m_id, k);
    RYML_ASSERT(ch != NONE);
    NodeRef const r(m_tree, ch);
    return r;
}

Synopsis

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

NodeRef const operator[](size_t pos) const

Description

O(num_children)

Source

Lines 307-315 in src/c4/yml/node.hpp.

NodeRef const operator[] (size_t pos) const
{
    RYML_ASSERT( ! is_seed());
    RYML_ASSERT(valid());
    size_t ch = m_tree->child(m_id, pos);
    RYML_ASSERT(ch != NONE);
    NodeRef const r(m_tree, ch);
    return r;
}





Add Discussion as Guest

Log in