I'm trying to compare rapidjson documents but it's giving an error message that I'm not sure how to fix (see above).
This is the rapidjson:
static const std::string& JSON()
{
static const std::string j =
"{"
"\"SimpleCompany:Manager\":{"
"\"read\":\"true\""
"\"update\":\"true\""
"\"delete\":\"true\""
"\"insert\":\"false\""
"},"
"\"SimpleCompany:Manager\":{"
"\"read\":\"true\""
"\"update\":\"true\""
"\"delete\":\"false\""
"\"insert\":\"false\""
"},"
"}";
return j;
}
This is where I try to compare two documents with presumably the same contents:
rapidjson::StringStream strStream(JSON().c_str());
rapidjson::Document origDocument;
origDocument.ParseStream(strStream); //newDocument obtained other way
ASSERT_TRUE(newDocument["read"] == origDocument["read"]); //error no operator [] matches these operands
ASSERT_TRUE(strcmp(newDocument["read"] , origDocument["read"])); //error no operator [] matches these operands
const rapidjson::Value& a1 = newDocument["read"]; //error no operator [] matches these operands
Any idea how to correctly compare their values? I tried two ways, but they didn't like the [.
Milo says that there's an equality operator. It looks like I'm comparing things like the rapidjson tutorial, although they are comparing the key with expected value, and I'm comparing keys of two documents for equality, which seems ok to me.