Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::is_anchor

bool is_anchor() const noexcept;

Tests whether the node is an anchor node.

Return Value

true if the node is an anchor node, false otherwise.

Example
#include <iomanip>
#include <iostream>
#include <fkYAML/node.hpp>

int main() {
    // create YAML nodes (both anchor/non-anchor)
    fkyaml::node anchor = true;
    anchor.add_anchor_name("anchor");
    fkyaml::node non_anchor = 123;

    // print the result of testing whether they are an anchor node or not.
    std::cout << std::boolalpha << anchor.is_anchor() << std::endl;
    std::cout << non_anchor.is_anchor() << std::endl;

    return 0;
}

output:

true
false

See Also