File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,7 +233,12 @@ class JSON_API Value {
233233 CZString (CZString&& other);
234234#endif
235235 ~CZString ();
236- CZString& operator =(CZString other);
236+ CZString& operator =(const CZString& other);
237+
238+ #if JSON_HAS_RVALUE_REFERENCES
239+ CZString& operator =(CZString&& other);
240+ #endif
241+
237242 bool operator <(CZString const & other) const ;
238243 bool operator ==(CZString const & other) const ;
239244 ArrayIndex index () const ;
@@ -447,7 +452,7 @@ Json::Value obj_value(Json::objectValue); // {}
447452 // / Equivalent to jsonvalue[jsonvalue.size()] = value;
448453 Value& append (const Value& value);
449454
450- #ifdef JSON_HAS_RVALUE_REFERENCES
455+ #if JSON_HAS_RVALUE_REFERENCES
451456 Value& append (Value&& value);
452457#endif
453458
Original file line number Diff line number Diff line change @@ -292,10 +292,20 @@ void Value::CZString::swap(CZString& other) {
292292 std::swap (index_, other.index_ );
293293}
294294
295- Value::CZString& Value::CZString::operator =(CZString other) {
296- swap (other);
295+ Value::CZString& Value::CZString::operator =(const CZString& other) {
296+ cstr_ = other.cstr_ ;
297+ index_ = other.index_ ;
298+ return *this ;
299+ }
300+
301+ #if JSON_HAS_RVALUE_REFERENCES
302+ Value::CZString& Value::CZString::operator =(CZString&& other) {
303+ cstr_ = other.cstr_ ;
304+ index_ = other.index_ ;
305+ other.cstr_ = nullptr ;
297306 return *this ;
298307}
308+ #endif
299309
300310bool Value::CZString::operator <(const CZString& other) const {
301311 if (!cstr_) return index_ < other.index_ ;
@@ -1145,7 +1155,7 @@ Value const& Value::operator[](CppTL::ConstString const& key) const
11451155
11461156Value& Value::append (const Value& value) { return (*this )[size ()] = value; }
11471157
1148- #ifdef JSON_HAS_RVALUE_REFERENCES
1158+ #if JSON_HAS_RVALUE_REFERENCES
11491159 Value& Value::append (Value&& value) { return (*this )[size ()] = value; }
11501160#endif
11511161
You can’t perform that action at this time.
0 commit comments