Added a move constructor / assignment operator to the old Clipper library
PolyTree class.
This commit is contained in:
parent
e22d007ab7
commit
b2a5a1d22f
1 changed files with 20 additions and 2 deletions
|
@ -154,16 +154,34 @@ private:
|
||||||
void AddChild(PolyNode& child);
|
void AddChild(PolyNode& child);
|
||||||
friend class Clipper; //to access Index
|
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
|
class PolyTree: public PolyNode
|
||||||
{
|
{
|
||||||
public:
|
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;
|
PolyNode* GetFirst() const;
|
||||||
void Clear();
|
void Clear();
|
||||||
int Total() const;
|
int Total() const;
|
||||||
private:
|
private:
|
||||||
|
PolyTree(const PolyTree &src) = delete;
|
||||||
|
PolyTree& operator=(const PolyTree &src) = delete;
|
||||||
PolyNodes AllNodes;
|
PolyNodes AllNodes;
|
||||||
friend class Clipper; //to access AllNodes
|
friend class Clipper; //to access AllNodes
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue