Skip to content

Commit ee7c118

Browse files
committed
partially revert "Switch to copy-and-swap idiom for operator=."
This partially reverts commit 45cd949. Ignored ValueInternal* changes, since those did not produce symbols for Debian build. (They must not have used the INTERNAL stuff.) Ignored CZString changes since those are private (and sizeof struct did not change). #78 Conflicts: include/json/value.h src/lib_json/json_internalarray.inl src/lib_json/json_internalmap.inl src/lib_json/json_value.cpp
1 parent 7921ac2 commit ee7c118

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: include/json/value.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Json::Value obj_value(Json::objectValue); // {}
256256
~Value();
257257

258258
// Deep copy, then swap(other).
259-
Value& operator=(Value other);
259+
Value &operator=(const Value &other);
260260
/// Swap everything.
261261
void swap(Value& other);
262262
/// Swap values but leave comments and source offsets in place.

Diff for: src/lib_json/json_value.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,9 @@ Value::~Value() {
426426
delete[] comments_;
427427
}
428428

429-
Value& Value::operator=(Value other) {
430-
swap(other);
429+
Value &Value::operator=(const Value &other) {
430+
Value temp(other);
431+
swap(temp);
431432
return *this;
432433
}
433434

0 commit comments

Comments
 (0)