Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::rend, fkyaml::basic_node::crend

reverse_iterator rend();
const_reverse_iterator rend() const;
const_reverse_iterator crend() const;

Returns a (constant) iterator to the reverse-end (= one before the first) 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-end (= one before 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 reverse-end (= one before the first) element.
    fkyaml::node::reverse_iterator it = n.rend();
    // decrement the iterator to point to the first element.
    --it;
    std::cout << *it << std::endl;
    return 0;
}

output:

foo

See Also