Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::rbegin, fkyaml::basic_node::crbegin

reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
const_reverse_iterator crbegin() const;

Returns a (constant) iterator to the reverse-beginning (= last) element of a container node.
Throws a fkyaml::type_error if a basic_node is neither a sequence nor mapping node.

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

Return Value

A (constant) iterator to the reverse-beginning (= 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 reverse-beginning (= last) element.
    fkyaml::node::reverse_iterator it = n.rbegin();
    std::cout << *it << std::endl;
    return 0;
}

output:

bar

See Also