mirror of https://github.com/CGAL/cgal
Merge pull request #5269 from GilesBathgate/move-assignment-operators
Move assignment operators
This commit is contained in:
commit
d6e9bdd0c1
|
|
@ -100,6 +100,17 @@ class Halfedge_base
|
|||
return *this;
|
||||
}
|
||||
|
||||
Halfedge_base<Refs>& operator=(Halfedge_base<Refs>&& e) noexcept
|
||||
{ center_vertex_ = std::move(e.center_vertex_);
|
||||
point_ = std::move(e.point_);
|
||||
mark_ = std::move(e.mark_);
|
||||
twin_ = std::move(e.twin_);
|
||||
out_sedge_ = std::move(e.out_sedge_);
|
||||
incident_sface_ = std::move(e.incident_sface_);
|
||||
info_ = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vertex_handle& center_vertex() { return center_vertex_; }
|
||||
Vertex_const_handle center_vertex() const { return center_vertex_; }
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,22 @@ class SHalfedge_base {
|
|||
return *this;
|
||||
}
|
||||
|
||||
SHalfedge_base<Refs>& operator=(SHalfedge_base<Refs>&& e) noexcept
|
||||
{
|
||||
source_ = std::move(e.source_);
|
||||
sprev_ = std::move(e.sprev_);
|
||||
snext_ = std::move(e.snext_);
|
||||
incident_sface_ = std::move(e.incident_sface_);
|
||||
twin_ = std::move(e.twin_);
|
||||
prev_ = std::move(e.prev_);
|
||||
next_ = std::move(e.next_);
|
||||
facet_ = std::move(e.facet_);
|
||||
info_ = 0;
|
||||
mark_ = std::move(e.mark_);
|
||||
circle_ = std::move(e.circle_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Mark& mark() { return mark_; }
|
||||
const Mark& mark() const { return mark_; }
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,15 @@ class SHalfloop_base {
|
|||
return *this;
|
||||
}
|
||||
|
||||
SHalfloop_base<Refs>& operator=(SHalfloop_base<Refs>&& l) noexcept
|
||||
{ twin_ = std::move(l.twin_);
|
||||
incident_sface_ = std::move(l.incident_sface_);
|
||||
facet_ = std::move(l.facet_);
|
||||
mark_ = std::move(l.mark_);
|
||||
circle_ = std::move(l.circle_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Mark& mark() { return mark_;}
|
||||
const Mark& mark() const { return mark_; }
|
||||
|
||||
|
|
|
|||
|
|
@ -375,11 +375,18 @@ protected:
|
|||
}
|
||||
|
||||
Nef_polyhedron_3& operator=(const Nef_polyhedron_3<Kernel,Items, Mark>& N1) {
|
||||
Base::operator=(N1);
|
||||
Base::operator=(N1); // copy the handle
|
||||
set_snc(snc());
|
||||
return (*this);
|
||||
}
|
||||
|
||||
Nef_polyhedron_3& operator=(Nef_polyhedron_3<Kernel,Items, Mark>&& N1) noexcept {
|
||||
N1.set_snc(snc()); // N1.set_snc sets N1.sncp_ not N1.snc_
|
||||
Base::operator=(std::move(N1)); // swap the handles
|
||||
set_snc(snc()); // snc() will return N1.snc_
|
||||
return (*this);
|
||||
}
|
||||
|
||||
~Nef_polyhedron_3() {
|
||||
CGAL_NEF_TRACEN("~Nef_polyhedron_3: destructor called for snc "<<&snc()<<
|
||||
", pl "<<pl());
|
||||
|
|
|
|||
|
|
@ -55,6 +55,12 @@ class Handle
|
|||
PTR->count++;
|
||||
}
|
||||
|
||||
Handle(Handle&& x) noexcept
|
||||
: PTR(x.PTR)
|
||||
{
|
||||
x.PTR = static_cast<Rep*>(0);
|
||||
}
|
||||
|
||||
~Handle()
|
||||
{
|
||||
if ( PTR && (--PTR->count == 0))
|
||||
|
|
@ -72,6 +78,13 @@ class Handle
|
|||
return *this;
|
||||
}
|
||||
|
||||
Handle&
|
||||
operator=(Handle&& x) noexcept
|
||||
{
|
||||
swap(*this,x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend void swap(Handle& a, Handle& b) noexcept { std::swap(a.PTR, b.PTR); }
|
||||
|
||||
void reset()
|
||||
|
|
|
|||
Loading…
Reference in New Issue