如何使用rapidjson將對象序列化爲std :: string? 我已經實現如何使用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
}
}
問題在連載的功能是什麼回來?