diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 92c7316..044a8fd 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -416,6 +416,13 @@ public: //! Default constructor creates a null value. GenericValue() : data_(), flags_(kNullFlag) {} +#ifdef RAPIDJSON_CXX11 + //! Move constructor in C++11 + GenericValue(GenericValue&& rhs) : data_(rhs.data_), flags_(rhs.flags_) { + rhs.flags_ = kNullFlag; // give up contents + } +#endif + private: //! Copy constructor is not permitted. GenericValue(const GenericValue& rhs); @@ -567,6 +574,13 @@ public: return *this; } +#ifdef RAPIDJSON_CXX11 + //! Move assignment in C++11 + GenericValue& operator=(GenericValue&& rhs) { + return *this = rhs.Move(); + } +#endif + //! Assignment of constant string reference (no copy) /*! \param str Constant string reference to be assigned \note This overload is needed to avoid clashes with the generic primitive type assignment overload below.