Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2016-12-13 20:59:18 +0300
committerbubnikv <bubnikv@gmail.com>2016-12-13 20:59:18 +0300
commitb2a5a1d22f67eba636d41f49c7684f2480fd3242 (patch)
tree0efbaee20516f54588644b79e70792e9c259748b /xs
parente22d007ab7a49edd1633e9950729806cadfc0783 (diff)
Added a move constructor / assignment operator to the old Clipper library
PolyTree class.
Diffstat (limited to 'xs')
-rw-r--r--xs/src/clipper.hpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/xs/src/clipper.hpp b/xs/src/clipper.hpp
index c8009e64e..47de7b182 100644
--- a/xs/src/clipper.hpp
+++ b/xs/src/clipper.hpp
@@ -153,17 +153,35 @@ private:
PolyNode* GetNextSiblingUp() const;
void AddChild(PolyNode& child);
friend class Clipper; //to access Index
- friend class ClipperOffset;
+ friend class ClipperOffset;
+ friend class PolyTree; //to implement the PolyTree::move operator
};
class PolyTree: public PolyNode
{
public:
- ~PolyTree(){Clear();};
+ PolyTree() {}
+ PolyTree(PolyTree &&src) { *this = std::move(src); }
+ virtual ~PolyTree(){Clear();};
+ PolyTree& operator=(PolyTree &&src) {
+ AllNodes = std::move(src.AllNodes);
+ Contour = std::move(src.Contour);
+ Childs = std::move(src.Childs);
+ Parent = nullptr;
+ Index = src.Index;
+ m_IsOpen = src.m_IsOpen;
+ m_jointype = src.m_jointype;
+ m_endtype = src.m_endtype;
+ for (size_t i = 0; i < Childs.size(); ++ i)
+ Childs[i]->Parent = this;
+ return *this;
+ }
PolyNode* GetFirst() const;
void Clear();
int Total() const;
private:
+ PolyTree(const PolyTree &src) = delete;
+ PolyTree& operator=(const PolyTree &src) = delete;
PolyNodes AllNodes;
friend class Clipper; //to access AllNodes
};