Fix non-rvalue Json::Value assignment operator (should copy, not move)
diff --git a/include/json/value.h b/include/json/value.h
index f057089..2da9559 100644
--- a/include/json/value.h
+++ b/include/json/value.h
@@ -327,10 +327,7 @@
/// 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);
diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp
index 056c475..791176e 100644
--- a/src/lib_json/json_value.cpp
+++ b/src/lib_json/json_value.cpp
@@ -518,18 +518,10 @@
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_;