Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::end

iterator end();
const_iterator end() const;

Returns an iterator to the past-the-last 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/end

Return Value

An iterator to the past-the-last 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 past-the-last element.
    fkyaml::node::iterator it = n.end();
    // decrement the iterator to point to the last element.
    --it;
    std::cout << *it << std::endl;
    return 0;
}

output:

bar

See Also