I have a Visual C++ Project in which I added the rapidjson library, which is tested to be working properly. But when I add a rapidjson::Document
type to the nested
Looking at the error it appears that the function returning the jsonObj
is doing some kind of a copy or move construction as a part of returning the value and the underlying classes do not allow this probably by making those constructors private members.
There are classes whose design requires that a copy or assignment is prohibited in order to prevent memory leaks or because the objects are singleton type objects and only one version of the object is allowed.
Looking at this documentation on rapidjson there is a note in the section on Move semantics that may be pertinent. It looks like they are preventing a Copy in order to improve performance.
jsonObj
doesn't have copy constructor and it can't have any copy constructor since Document's copy constructor is disabled in rapidjson. Try to hold pointer to document instead, something like this :
class jsonObj {
string jsonStr;
string message;
Document* doc; //HERE IS THE PROBLEM
bool validMsg;
}
Or pass document(jsonObj
) from outside to:
jsonObj query(string sSQL);
For example:
query(string sSQL, jsonObj & out_obj)