I\'m making a class and I want to return my class inside a method. My class has a rapidjson::Document
object.
You can see the previous problems here: L
Use the CopyFrom method on a new Document:
rapidjson::Document inDoc; // source document
rapidjson::Document outDoc; // destination document
outDoc.CopyFrom(inDoc, outDoc.GetAllocator());
I tested this approach and changes made to the output document had no effect on the input document. Make sure the CopyFrom method is given the output document's allocator.