Revert "Switch to copy-and-swap idiom for operator=."

This reverts commit 45cd9490cd261da31cef84a44d2c587be7e26e99.

Ignored ValueInternal* changes, since those did not produce symbols for
Debian build. (They must not have used the INTERNAL stuff.)

  https://github.com/open-source-parsers/jsoncpp/issues/78

Conflicts:
	include/json/value.h
	src/lib_json/json_internalarray.inl
	src/lib_json/json_internalmap.inl
	src/lib_json/json_value.cpp
This commit is contained in:
Christopher Dunn 2014-11-17 00:13:18 -06:00
parent 9c80798038
commit add941c1a9
2 changed files with 8 additions and 6 deletions

View File

@ -171,7 +171,7 @@ private:
CZString(const char* cstr, DuplicationPolicy allocate); CZString(const char* cstr, DuplicationPolicy allocate);
CZString(const CZString& other); CZString(const CZString& other);
~CZString(); ~CZString();
CZString& operator=(CZString other); CZString &operator=(const CZString &other);
bool operator<(const CZString& other) const; bool operator<(const CZString& other) const;
bool operator==(const CZString& other) const; bool operator==(const CZString& other) const;
ArrayIndex index() const; ArrayIndex index() const;
@ -238,7 +238,7 @@ Json::Value obj_value(Json::objectValue); // {}
Value(const Value& other); Value(const Value& other);
~Value(); ~Value();
Value& operator=(Value other); Value &operator=(const Value &other);
/// Swap values. /// Swap values.
/// \note Currently, comments are intentionally not swapped, for /// \note Currently, comments are intentionally not swapped, for
/// both logic and efficiency. /// both logic and efficiency.

View File

@ -188,8 +188,9 @@ void Value::CZString::swap(CZString& other) {
std::swap(index_, other.index_); std::swap(index_, other.index_);
} }
Value::CZString& Value::CZString::operator=(CZString other) { Value::CZString &Value::CZString::operator=(const CZString &other) {
swap(other); CZString temp(other);
swap(temp);
return *this; return *this;
} }
@ -478,8 +479,9 @@ Value::~Value() {
delete[] comments_; delete[] comments_;
} }
Value& Value::operator=(Value other) { Value &Value::operator=(const Value &other) {
swap(other); Value temp(other);
swap(temp);
return *this; return *this;
} }