diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index a3d3af22911..5749e72c58e 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -141,6 +141,19 @@ public: virtual ~Constrained_Delaunay_triangulation_2() {} + // Ensure rule-of-five: define the copy- and move- constructors + // as well as the copy- and move- assignment operators. + Constrained_Delaunay_triangulation_2( + const Constrained_Delaunay_triangulation_2 &) = default; + Constrained_Delaunay_triangulation_2( + Constrained_Delaunay_triangulation_2 &&) = default; + + Constrained_Delaunay_triangulation_2 & + operator=(const Constrained_Delaunay_triangulation_2 &) = default; + + Constrained_Delaunay_triangulation_2 & + operator=(Constrained_Delaunay_triangulation_2 &&) = default; + // FLIPS bool is_flipable(Face_handle f, int i, bool perturb = true) const; void flip(Face_handle& f, int i); diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 9fe6473e79a..4198a2dff18 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -201,6 +201,17 @@ public: //TODO Is that destructor correct ? virtual ~Constrained_triangulation_2() {} + // Ensure rule-of-five: define the copy- and move- constructors + // as well as the copy- and move- assignment operators. + Constrained_triangulation_2(const Constrained_triangulation_2 &) = default; + Constrained_triangulation_2(Constrained_triangulation_2 &&) = default; + + Constrained_triangulation_2 & + operator=(const Constrained_triangulation_2 &) = default; + + Constrained_triangulation_2 & + operator=(Constrained_triangulation_2 &&) = default; + Constrained_edges_iterator constrained_edges_begin() const { diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index b570e082a0c..dd85df9acb0 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -90,6 +90,11 @@ public: : Triangulation_2(tr) { CGAL_triangulation_postcondition(is_valid()); } + Delaunay_triangulation_2(Delaunay_triangulation_2&&) = default; + Delaunay_triangulation_2& operator=(const Delaunay_triangulation_2&) = default; + Delaunay_triangulation_2& operator=(Delaunay_triangulation_2&&) = default; + ~Delaunay_triangulation_2() = default; + template Delaunay_triangulation_2(InputIterator first, InputIterator last, const Gt& gt = Gt()) diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 62c1d72902d..fa892beffc0 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -241,6 +241,7 @@ public: // CONSTRUCTORS Triangulation_2(const Geom_traits& geom_traits=Geom_traits()); Triangulation_2(const Triangulation_2 &tr); + Triangulation_2(Triangulation_2&&) = default; template Triangulation_2(InputIterator first, InputIterator last, @@ -253,6 +254,10 @@ public: //Assignement Triangulation_2 &operator=(const Triangulation_2 &tr); + Triangulation_2 &operator=(Triangulation_2 &&) = default; + + // Destructor + ~Triangulation_2() = default; //Helping void copy_triangulation(const Triangulation_2 &tr); diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_Del_triangulation_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_Del_triangulation_2.h index bdd49c1c738..6581267f164 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_Del_triangulation_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_const_Del_triangulation_2.h @@ -30,6 +30,11 @@ template void _test_cls_const_Del_triangulation(const Triangul&) { + static_assert(std::is_nothrow_move_constructible::value, + "move cstr is missing"); + static_assert(std::is_nothrow_move_assignable::value, + "move assignment is missing"); + //typedef Triangulation Cls; typedef typename Triangul::Geom_traits Gt; diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.h index eaa9e936e1c..1fe1183d3db 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_constrained_triangulation_2.h @@ -92,6 +92,11 @@ template void _test_cls_constrained_triangulation(const Triang &) { + static_assert(std::is_nothrow_move_constructible::value, + "move cstr is missing"); + static_assert(std::is_nothrow_move_assignable::value, + "move assignment is missing"); + // typedef Triangulation Cls; typedef typename Triang::Geom_traits Gt; diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_triangulation_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_triangulation_2.h index 2204331cfe8..f9cc6fcb2aa 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_triangulation_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_triangulation_2.h @@ -39,6 +39,11 @@ template void _test_cls_delaunay_triangulation_2( const Del & ) { + static_assert(std::is_nothrow_move_constructible::value, + "move cstr is missing"); + static_assert(std::is_nothrow_move_assignable::value, + "move assignment is missing"); + //typedef Del Delaunay; typedef typename Del::Point Point; typedef typename Del::Locate_type Locate_type; diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.h index ce242c40be3..498ff9139be 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.h @@ -39,6 +39,10 @@ template void _test_cls_triangulation_2( const Triangul & ) { + static_assert(std::is_nothrow_move_constructible::value, + "move cstr is missing"); + static_assert(std::is_nothrow_move_assignable::value, + "move assignment is missing"); //typedef Triangulation Cls; // We assume the traits class has been tested already diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_traits.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_traits.h index 10e712567e9..4eaf0541a29 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_traits.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_traits.h @@ -36,7 +36,6 @@ protected: double _x, _y; public: Triangulation_test_point() {} - Triangulation_test_point(const Point &p) : _x(p.test_x()), _y(p.test_y()) {} Triangulation_test_point(double x, double y) : _x(x), _y(y) {} Triangulation_test_point(double hx, double hy, double hw) : _x(hx/hw), _y(hy/hw) @@ -47,7 +46,6 @@ public: bool compare(const Point &p) const { return test_x()==p.test_x() && test_y()==p.test_y(); } bool uncompare(const Point &p) const { return !compare(p); } - Point &operator=(const Point &p) { _x=p.test_x(); _y=p.test_y(); return *this; } void test_set(TESTFT x, TESTFT y) { _x=x; _y=y; } bool operator==(const Point &p) const {return this->compare(p);} }; @@ -436,11 +434,6 @@ public: typedef Triangulation_test_Construct_ray_2 Construct_ray_2; - _Triangulation_test_traits() {} - _Triangulation_test_traits(const _Triangulation_test_traits &) {} - _Triangulation_test_traits &operator= - (const _Triangulation_test_traits &) { return *this; } - Less_x_2 less_x_2_object() const { return Less_x_2();}