Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::end, fkyaml::basic_node::cend

iterator end();
const_iterator end() const;
const_iterator cend() const;

Returns a (constant) iterator to the past-the-last 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/end

Return Value

A (constant) iterator to the past-the-last 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 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