Question
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);
OTHER TIPS
In the new version, you can parse a string directly (see here):
YAML::Node node = YAML::Load("[1, 2, 3]");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow