File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -233,7 +233,12 @@ class JSON_API Value {
233
233
CZString (CZString&& other);
234
234
#endif
235
235
~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
+
237
242
bool operator <(CZString const & other) const ;
238
243
bool operator ==(CZString const & other) const ;
239
244
ArrayIndex index () const ;
@@ -447,7 +452,7 @@ Json::Value obj_value(Json::objectValue); // {}
447
452
// / Equivalent to jsonvalue[jsonvalue.size()] = value;
448
453
Value& append (const Value& value);
449
454
450
- #ifdef JSON_HAS_RVALUE_REFERENCES
455
+ #if JSON_HAS_RVALUE_REFERENCES
451
456
Value& append (Value&& value);
452
457
#endif
453
458
Original file line number Diff line number Diff line change @@ -292,10 +292,20 @@ void Value::CZString::swap(CZString& other) {
292
292
std::swap (index_, other.index_ );
293
293
}
294
294
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 ;
297
306
return *this ;
298
307
}
308
+ #endif
299
309
300
310
bool Value::CZString::operator <(const CZString& other) const {
301
311
if (!cstr_) return index_ < other.index_ ;
@@ -1145,7 +1155,7 @@ Value const& Value::operator[](CppTL::ConstString const& key) const
1145
1155
1146
1156
Value& Value::append (const Value& value) { return (*this )[size ()] = value; }
1147
1157
1148
- #ifdef JSON_HAS_RVALUE_REFERENCES
1158
+ #if JSON_HAS_RVALUE_REFERENCES
1149
1159
Value& Value::append (Value&& value) { return (*this )[size ()] = value; }
1150
1160
#endif
1151
1161
You can’t perform that action at this time.
0 commit comments