我的代码在这里:
// Using chinese
std::string c1 = "中文1";
std::string c2 = "中文2";
// write json text
ptree pt_write_;
pt_write_.put("1", c1);
pt_write_.put("2", c2);
std::ostringstream os;
write_json(os, pt_write_);
std::string a = os.str();
// read json text
ptree pt_r;
std::istringstream is(a);
read_json(is, pt_r);
std::string b = pt_r.get<std::string>("2");
有一个问题,当我运行代码时出现此错误。我该如何解决?
In the file boost\property_tree\json_parser\detail\narrow_encoding.hpp
步骤1:
替换trail_table函数,当数组中的值为-1时,将值替换为1;
第2步:
将代码替换if (cur == end || !is_trail(*cur))
为 ->if (cur == end/* || !is_trail(*cur)*/)
然后就可以了
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句