如何使用 rapidjson 将对象序列化为 std::string?我已经实施
class Person{
public:
std::string name;
uint64 id; // uint64 is typedef
template <typename Writer>
void Serialize(Writer& writer) const {
writer.StartObject();
writer.String("name");
writer.String(name);
writer.String(("id"));
writer.Uint64(id);
writer.EndObject();
}
std::string serialize(){
FileStream s(stdout);
PrettyWriter<FileStream> writer(s);
Serialize(writer);
return ? /// There is a problem
}
}
问题在于序列化函数要返回什么?