Fix non-rvalue Json::Value assignment operator (should copy, not move)

This commit is contained in:
Александр Малинин 2017-07-31 15:29:02 +03:00
parent 9a048e5766
commit 6a15ca6442
2 changed files with 2 additions and 13 deletions

View File

@ -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);

View File

@ -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_;