문제

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.)

도움이 되었습니까?

해결책

Try using a stringstream:

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

다른 팁

In the new version, you can parse a string directly (see here):

YAML::Node node = YAML::Load("[1, 2, 3]");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top