Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::operator>>

inline std::istream& operator>>(std::istream& is, basic_node& n);

Insertion operator for basic_node template class.
Deserializes an input stream into a basic_node.
This API is a wrapper of basic_node::deserialize() function for input streams to simplify the implementation in the client code.
Note that the contents of the input stream must be encoded in either the UTF-8, UTF-16BE/LE or UTF-32LE/BE format and begin with either a byte order mark or an ASCII character.

Parameters

is [in]
An input stream object.
n [in]
A basic_node object.

Return Value

Reference to the input stream object is.

Example
foo: true
bar: 123
baz: 3.14
#include <fstream>
#include <iostream>
#include <fkYAML/node.hpp>

int main() {
    std::ifstream ifs("input.yaml");
    fkyaml::node n;
    ifs >> n;

    // print the deserialization result.
    std::cout << n << std::endl;

    return 0;
}

output:

bar: 123
baz: 3.14
foo: true

See Also