Commit 30969707 authored by Milo Yip's avatar Milo Yip

Merge pull request #63 from pah/fixes/value-assign

GenericValue::operator= : fixup assignment operator (again)
parents 31113b4f 41d211cd
...@@ -501,7 +501,8 @@ public: ...@@ -501,7 +501,8 @@ public:
\see GenericStringRef, operator=(T) \see GenericStringRef, operator=(T)
*/ */
GenericValue& operator=(StringRefType str) { GenericValue& operator=(StringRefType str) {
return (*this).operator=<StringRefType>(str); GenericValue s(str);
return *this = s;
} }
//! Assignment with primitive types. //! Assignment with primitive types.
...@@ -519,9 +520,8 @@ public: ...@@ -519,9 +520,8 @@ public:
template <typename T> template <typename T>
RAPIDJSON_DISABLEIF_RETURN(internal::IsPointer<T>,GenericValue&) RAPIDJSON_DISABLEIF_RETURN(internal::IsPointer<T>,GenericValue&)
operator=(T value) { operator=(T value) {
this->~GenericValue(); GenericValue v(value);
new (this) GenericValue(value); return *this = v;
return *this;
} }
//! Deep-copy assignment from Value //! Deep-copy assignment from Value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment