mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-26 18:51:04 +08:00
Fix non-rvalue Json::Value assignment operator (should copy, not move)
This commit is contained in:
parent
9a048e5766
commit
6a15ca6442
@ -327,10 +327,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
||||
|
||||
/// Deep copy, then swap(other).
|
||||
/// \note Over-write existing comments. To preserve comments, use #swapPayload().
|
||||
Value& operator=(const Value& other);
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
Value& operator=(Value&& other);
|
||||
#endif
|
||||
Value& operator=(Value other);
|
||||
|
||||
/// Swap everything.
|
||||
void swap(Value& other);
|
||||
|
@ -518,18 +518,10 @@ Value::~Value() {
|
||||
value_.uint_ = 0;
|
||||
}
|
||||
|
||||
Value& Value::operator=(const Value& other) {
|
||||
swap(const_cast<Value&>(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
Value& Value::operator=(Value&& other) {
|
||||
initBasic(nullValue);
|
||||
Value& Value::operator=(Value other) {
|
||||
swap(other);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Value::swapPayload(Value& other) {
|
||||
ValueType temp = type_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user