Skip to content

Commit c747846

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 44fb853 commit c747846

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

258258
/// Deep copy, then swap(other).
259259
/// \note Over-write existing comments. To preserve comments, use #swapPayload().
260-
Value& operator=(Value other);
260+
Value &operator=(const Value &other);
261261
/// Swap everything.
262262
void swap(Value& other);
263263
/// 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
@@ -421,8 +421,9 @@ Value::~Value() {
421421
delete[] comments_;
422422
}
423423

424-
Value& Value::operator=(Value other) {
425-
swap(other);
424+
Value &Value::operator=(const Value &other) {
425+
Value temp(other);
426+
swap(temp);
426427
return *this;
427428
}
428429

0 commit comments

Comments
 (0)