Skip to content

Commit 533cd09

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). open-source-parsers#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 da4cc85 commit 533cd09

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/json/value.h

Lines changed: 1 addition & 1 deletion
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.

src/lib_json/json_value.cpp

Lines changed: 3 additions & 2 deletions
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)