[Bf-blender-cvs] [def8fd6330f] master: Cleanup: support moving InstanceReference

Jacques Lucke noreply at git.blender.org
Tue Sep 28 10:19:56 CEST 2021


Commit: def8fd6330fde5a7add9ab89efb6c08576355eb2
Author: Jacques Lucke
Date:   Tue Sep 28 10:17:49 2021 +0200
Branches: master
https://developer.blender.org/rBdef8fd6330fde5a7add9ab89efb6c08576355eb2

Cleanup: support moving InstanceReference

===================================================================

M	source/blender/blenkernel/BKE_geometry_set.hh

===================================================================

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 08bfdbf2382..f6a58e57298 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -509,6 +509,13 @@ class InstanceReference {
     }
   }
 
+  InstanceReference(InstanceReference &&other)
+      : type_(other.type_), data_(other.data_), geometry_set_(std::move(other.geometry_set_))
+  {
+    other.type_ = Type::None;
+    other.data_ = nullptr;
+  }
+
   InstanceReference &operator=(const InstanceReference &other)
   {
     if (this == &other) {
@@ -519,6 +526,16 @@ class InstanceReference {
     return *this;
   }
 
+  InstanceReference &operator=(InstanceReference &&other)
+  {
+    if (this == &other) {
+      return *this;
+    }
+    this->~InstanceReference();
+    new (this) InstanceReference(std::move(other));
+    return *this;
+  }
+
   Type type() const
   {
     return type_;



More information about the Bf-blender-cvs mailing list