0029258: Foundation Classes - provide move constructors for string classes
[occt.git] / src / NCollection / NCollection_UtfString.hxx
index 2cacbbb..210ac96 100755 (executable)
@@ -80,6 +80,11 @@ public:
   //! @param theCopy string to copy.
   NCollection_UtfString (const NCollection_UtfString& theCopy);
 
+#ifndef OCCT_NO_RVALUE_REFERENCE
+  //! Move constructor
+  NCollection_UtfString (NCollection_UtfString&& theOther);
+#endif
+
   //! Copy constructor from UTF-8 string.
   //! @param theCopyUtf8 UTF-8 string to copy
   //! @param theLength   optional length limit in Unicode symbols (NOT bytes!)
@@ -196,7 +201,18 @@ public:
 public: //! @name assign operators
 
   //! Copy from another string.
-  const NCollection_UtfString& operator= (const NCollection_UtfString& theOther);
+  const NCollection_UtfString& Assign (const NCollection_UtfString& theOther);
+
+  //! Exchange the data of two strings (without reallocating memory).
+  void Swap (NCollection_UtfString& theOther);
+
+  //! Copy from another string.
+  const NCollection_UtfString& operator= (const NCollection_UtfString& theOther) { return Assign (theOther); }
+
+#ifndef OCCT_NO_RVALUE_REFERENCE
+  //! Move assignment operator.
+  NCollection_UtfString& operator= (NCollection_UtfString&& theOther) { Swap (theOther); return *this; }
+#endif
 
   //! Copy from UTF-8 NULL-terminated string.
   const NCollection_UtfString& operator= (const char* theStringUtf8);