Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::begin, fkyaml::basic_node::cbegin

iterator begin();
const_iterator begin() const;
const_iterator cbegin() const;

Returns a (constant) iterator to the first element of a container node.
If a basic_node is neither a sequence nor mapping, a fkyaml::type_error will be thrown.

Image from https://en.cppreference.com/w/cpp/iterator/begin

Return Value

A (constant) iterator to the first element of a container node.

Examples

Example
#include <iostream>
#include <fkYAML/node.hpp>

int main() {
    // create a sequence node.
    fkyaml::node n = {"foo", "bar"};
    // get an iterator to the first element.
    fkyaml::node::iterator it = n.begin();
    std::cout << *it << std::endl;
    return 0;
}

output:

foo

See Also