Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::mapping

static basic_node mapping();
static basic_node mapping(const mapping_type& seq);
static basic_node mapping(mapping_type&& seq);

The factory method which constructs a basic_node with the node_t::MAPPING type from a mapping node value.
Calling this API with no arguments will constructs a basic_node with an empty mapping node value.
The resulting basic_node has the node_t::MAPPING type.

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

int main() {
    fkyaml::node::mapping_type m = {{"foo", false}, {"bar", 3.14}};
    fkyaml::node n = fkyaml::node::mapping(m);
    std::cout << n << std::endl;
    return 0;
}

output:

bar: 3.14
foo: false

See Also