diff --git a/Nef_3/include/CGAL/Nef_3/Halfedge.h b/Nef_3/include/CGAL/Nef_3/Halfedge.h index 3903477b915..21506e7db3b 100644 --- a/Nef_3/include/CGAL/Nef_3/Halfedge.h +++ b/Nef_3/include/CGAL/Nef_3/Halfedge.h @@ -100,6 +100,17 @@ class Halfedge_base return *this; } + Halfedge_base& operator=(Halfedge_base&& 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_; } diff --git a/Nef_3/include/CGAL/Nef_3/SHalfedge.h b/Nef_3/include/CGAL/Nef_3/SHalfedge.h index f390132078f..ddf5b382b1d 100644 --- a/Nef_3/include/CGAL/Nef_3/SHalfedge.h +++ b/Nef_3/include/CGAL/Nef_3/SHalfedge.h @@ -114,6 +114,22 @@ class SHalfedge_base { return *this; } + SHalfedge_base& operator=(SHalfedge_base&& 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_; } diff --git a/Nef_3/include/CGAL/Nef_3/SHalfloop.h b/Nef_3/include/CGAL/Nef_3/SHalfloop.h index c4abb9ebcdc..e6cc98bf944 100644 --- a/Nef_3/include/CGAL/Nef_3/SHalfloop.h +++ b/Nef_3/include/CGAL/Nef_3/SHalfloop.h @@ -75,6 +75,15 @@ class SHalfloop_base { return *this; } + SHalfloop_base& operator=(SHalfloop_base&& 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_; } diff --git a/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Nef_3/include/CGAL/Nef_polyhedron_3.h index 4110b28f929..8a2e1e16520 100644 --- a/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -375,11 +375,18 @@ protected: } Nef_polyhedron_3& operator=(const Nef_polyhedron_3& N1) { - Base::operator=(N1); + Base::operator=(N1); // copy the handle set_snc(snc()); return (*this); } + Nef_polyhedron_3& operator=(Nef_polyhedron_3&& 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 "<count++; } + Handle(Handle&& x) noexcept + : PTR(x.PTR) + { + x.PTR = static_cast(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()