title: Perform a copy of Document object of rapidjson
body: <p>I'm making a class and I want to return my class inside a method. My class has a <code>rapidjson::Document</code> object. </p>
  
  <p>You can see the previous problems here: <a href="https://stackoverflow.com/q/22682513/1967056">LNK2019: &quot;Unresolved external symbol&quot; with rapidjson</a></p>
  
  <p>As I discovered, rapidjson prevent you to perform any kind of copy of the <code>Document</code> object, and then the default copy of the class containing a <code>Document</code> object failed. I'm trying to define my own Copy Constructor but I need to perform a copy of the object. <a href="https://stackoverflow.com/a/19604013/1967056">I saw a way</a> to hypothetically copy the object with <code>.Accept()</code> method, but is returning me a lot of errors inside the <code>rapidjson::Document</code> class:</p>
  
  <blockquote>
    <p>error C2248: 'cannot access private member declared in class `rapidjson::GenericDocument'</p>
  </blockquote>
  
  <p>This is my Copy Constructor:</p>
  
  <pre><code>jsonObj::jsonObj(jsonObj&amp; other)
  {
      jsonStr = other.jsonStr;
      message = other.message;
  
      //doc = other.doc;
      doc.Accept(other.doc);
  
      validMsg = other.validMsg;
  }
  </code></pre>
  
  <p>I found <a href="https://code.google.com/p/rapidjson/source/browse/trunk/include/rapidjson/document.h" rel="nofollow noreferrer">in the code of the library</a> (line 52-54) that "<code>Copy constructor is not permitted</code>".</p>
  
  <p>This is my class:</p>
  
  <pre><code>class jsonObj {
      string jsonStr;
      Document doc; 
  
  public:
      jsonObj(string json);
      jsonObj(jsonObj&amp; other);
  
      string getJsonStr();
  };
  </code></pre>
  
  <p>The method:</p>
  
  <pre><code>jsonObj testOBJ()
  {
      string json = "{error:null, message:None, errorMessage:MoreNone}";
      jsonObj b(json);
      return b; //It fails here if I return a nested class with a rapidjson::Document in it. Returning NULL works
  }
  </code></pre>
  
  <p>So how to perform a copy of the <code>Document</code> element?</p>