Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::begin

iterator begin();
const_iterator begin() const;

Returns an iterator to the first element of a container node value.
Throws a fkyaml::exception if a basic_node does not have a sequence nor mapping value.

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

Return Value

An iterator to the first element of a container node value (either sequence or mapping).

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