我试图读取放气的 json 并遇到类型转换问题,这里是代码
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
std::istringstream iss(std::ios::binary);
iss.rdbuf()->pubsetbuf(buf, len);
iss.imbue( std::locale("ru_RU.CP1251") );
in.push( boost::iostreams::zlib_decompressor() );
in.push( iss );
boost::property_tree::ptree pt;
boost::property_tree::json_parser::read_json(in, pt); // <-- Compile error
编译器说:
src/ABPacking.cpp:48: 错误: 没有匹配函数调用'read_json(boost::iostreams::filtering_streambuf, std::allocator, boost::iostreams::public_>&, boost::property_tree::ptree&) '</p>
问题是如何在没有不必要的数据复制的情况下将filtering_streambuf传递给read_json ?