Skip to content

Commit e779968

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 a12f2b9 commit e779968

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
@@ -425,8 +425,9 @@ Value::~Value() {
425425
delete[] comments_;
426426
}
427427

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

0 commit comments

Comments
 (0)