Commit ef22ca17 authored by Ted Lyngmo's avatar Ted Lyngmo

Fix -Werror=effc++ errors with GNU 6.3.1

Fix "'MyHandler::type’ should be initialized in the member
initialization list [-Werror=effc++]" errors.

https://github.com/miloyip/rapidjson/issues/874
parent c64f378f
...@@ -16,13 +16,7 @@ struct MyHandler { ...@@ -16,13 +16,7 @@ struct MyHandler {
const char* type; const char* type;
std::string data; std::string data;
MyHandler() : type(), data() { Null(); } MyHandler() : type(), data() {}
MyHandler(const MyHandler& cpy) : type(cpy.type),data(cpy.data) {}
MyHandler& operator=(const MyHandler& cpy) {
type = cpy.type;
data = cpy.data;
return *this;
}
bool Null() { type = "Null"; data.clear(); return true; } bool Null() { type = "Null"; data.clear(); return true; }
bool Bool(bool b) { type = "Bool:"; data = b? "true": "false"; return true; } bool Bool(bool b) { type = "Bool:"; data = b? "true": "false"; return true; }
...@@ -38,6 +32,9 @@ struct MyHandler { ...@@ -38,6 +32,9 @@ struct MyHandler {
bool EndObject(SizeType memberCount) { type = "EndObject:"; data = stringify(memberCount); return true; } bool EndObject(SizeType memberCount) { type = "EndObject:"; data = stringify(memberCount); return true; }
bool StartArray() { type = "StartArray"; data.clear(); return true; } bool StartArray() { type = "StartArray"; data.clear(); return true; }
bool EndArray(SizeType elementCount) { type = "EndArray:"; data = stringify(elementCount); return true; } bool EndArray(SizeType elementCount) { type = "EndArray:"; data = stringify(elementCount); return true; }
private:
MyHandler(const MyHandler& noCopyConstruction);
MyHandler& operator=(const MyHandler& noAssignment);
}; };
int main() { int main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment