Explorar o código

ASE: Explicitly write out Material move constructor and assignment operator

Because MSVC doesn't support defaulting them
Turo Lamminen %!s(int64=7) %!d(string=hai) anos
pai
achega
a8fd9f668f
Modificáronse 1 ficheiros con 29 adicións e 3 borrados
  1. 29 3
      code/ASEParser.h

+ 29 - 3
code/ASEParser.h

@@ -80,10 +80,36 @@ struct Material : public D3DS::Material
 
 
 
 
     Material(const Material &other)            = default;
     Material(const Material &other)            = default;
-    Material(Material &&other)                 = default;
-
     Material &operator=(const Material &other) = default;
     Material &operator=(const Material &other) = default;
-    Material &operator=(Material &&other)      = default;
+
+
+    //! Move constructor. This is explicitly written because MSVC doesn't support defaulting it
+    Material(Material &&other)
+    : D3DS::Material(std::move(other))
+    , avSubMaterials(std::move(other.avSubMaterials))
+    , pcInstance(std::move(other.pcInstance))
+    , bNeed(std::move(other.bNeed))
+    {
+        other.pcInstance = nullptr;
+    }
+
+
+    Material &operator=(Material &&other) {
+        if (this == &other) {
+            return *this;
+        }
+
+        D3DS::Material::operator=(std::move(other));
+
+        avSubMaterials = std::move(other.avSubMaterials);
+        pcInstance = std::move(other.pcInstance);
+        bNeed = std::move(other.bNeed);
+
+        other.pcInstance = nullptr;
+
+        return *this;
+    }
+
 
 
     ~Material() {}
     ~Material() {}