Skip to content

Commit 29f69f2

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 8a5d753 commit 29f69f2

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
@@ -283,7 +283,7 @@ Json::Value obj_value(Json::objectValue); // {}
283283

284284
/// Deep copy, then swap(other).
285285
/// \note Over-write existing comments. To preserve comments, use #swapPayload().
286-
Value& operator=(Value other);
286+
Value &operator=(const Value &other);
287287
/// Swap everything.
288288
void swap(Value& other);
289289
/// 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
@@ -466,8 +466,9 @@ Value::~Value() {
466466
delete[] comments_;
467467
}
468468

469-
Value& Value::operator=(Value other) {
470-
swap(other);
469+
Value &Value::operator=(const Value &other) {
470+
Value temp(other);
471+
swap(temp);
471472
return *this;
472473
}
473474

0 commit comments

Comments
 (0)