[geos-commits] [SCM] GEOS branch main updated. c85a07d57505fc8ea6502756e9c4dde67e228cd3

git at osgeo.org git at osgeo.org
Tue Sep 24 15:06:45 PDT 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, main has been updated
       via  c85a07d57505fc8ea6502756e9c4dde67e228cd3 (commit)
      from  bf2257aa3794b483fefe23497209a79d40492841 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c85a07d57505fc8ea6502756e9c4dde67e228cd3
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Sep 24 15:06:14 2024 -0700

    Add move constructor and move assignment, closes GH-1161

diff --git a/include/geos/index/quadtree/Quadtree.h b/include/geos/index/quadtree/Quadtree.h
index 9f92f609e..8d92c5ede 100644
--- a/include/geos/index/quadtree/Quadtree.h
+++ b/include/geos/index/quadtree/Quadtree.h
@@ -188,6 +188,31 @@ public:
     Quadtree(const Quadtree&) = delete;
     Quadtree& operator=(const Quadtree&) = delete;
 
+
+    // Move constructor
+    Quadtree(Quadtree&& other) noexcept :
+        newEnvelopes(std::move(other.newEnvelopes)),
+        root(other.root),
+        minExtent(other.minExtent)
+    {
+        // The contents of 'other' are moved to 'this'
+        // 'other' will be empty after the move
+    };
+
+    // Move assignment operator
+    Quadtree& operator=(Quadtree&& other) noexcept
+    {
+        if (this != &other) {
+            // Move the vector from 'other' to 'this'
+            // 'newEnvelopes.data' will be empty after this operation
+            newEnvelopes.clear();
+            newEnvelopes = std::move(other.newEnvelopes);
+            minExtent = other.minExtent;
+            root = other.root;
+        }
+        return *this;
+    };
+
 };
 
 } // namespace geos::index::quadtree

-----------------------------------------------------------------------

Summary of changes:
 include/geos/index/quadtree/Quadtree.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list