Ask questionsmove document into value
After rapidjson::Document parsing rapidjson::StringStream and hold the DOM tree. Is it possible to move the DOM into a rapidjson::Value? I can't figure out how to do this, which means my API can not be symmetric when encoding and decoding into and from string. I currently use CopyFrom to get all the data out of rapidjson::Document into rapidjson::Value. But this create a deep copy ineffeciency which I believe RapidJSON's design principle is against.
Answer questions miloyip
How about using swapping?
Document d; Value v; d.Swap(v);
But need to remind that the values in document is allocated by the document's allocator. Need to preserve the lifetime of document.