Search code examples
c++yaml-cpp

yaml-cpp parsing strings


Is it possible to parse YAML formatted strings with yaml-cpp?

There isn't a YAML::Parser::Parser(std::string&) constructor. (I'm getting a YAML string via libcurl from a http-server.)


Solution

  • Try using a stringstream:

    std::string s = "name: YAML from libcurl";
    std::stringstream ss(s);
    YAML::Parser parser(ss);