diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_2.h index f6bea855929..2593af30845 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Weighted_point_2.h @@ -53,6 +53,7 @@ public: Weighted_pointC2(const Origin &o) : base(o, 0) {} + explicit Weighted_pointC2 (const Point_2 &p) : base(p,0) {} diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Weighted_point_2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Weighted_point_2.h index 8a00e8a2a41..915eb229b07 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Weighted_point_2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Weighted_point_2.h @@ -53,6 +53,7 @@ public: Weighted_pointH2(const Origin &o) : base(o, 0) {} + explicit Weighted_pointH2 (const Point_2 &p) : base(p,0) {} diff --git a/Kernel_23/doc/Kernel_23/CGAL/Point_2.h b/Kernel_23/doc/Kernel_23/CGAL/Point_2.h index 7029e043d04..ecdc67a7e98 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Point_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Point_2.h @@ -85,8 +85,11 @@ Point_2(const Kernel::FT &x, const Kernel::FT &y); /*! introduces a point from a weighted point. + +\warning The `explicit` keyword is used to not have accidental implicit conversions + between Point_2 and Weighted_point_2. */ -Point_2(const Kernel::Weighted_point_2 &wp); +explicit Point_2(const Kernel::Weighted_point_2 &wp); /// @} diff --git a/Kernel_23/doc/Kernel_23/CGAL/Point_3.h b/Kernel_23/doc/Kernel_23/CGAL/Point_3.h index d5487c9a81b..d6c761b3e61 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Point_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Point_3.h @@ -66,8 +66,11 @@ Point_3(const Kernel::FT &x, const Kernel::FT &y, const Kernel::FT &z); /*! introduces a point from a weighted point. + +\warning The `explicit` keyword is used to not have accidental implicit conversions + between Point_3 and Weighted_point_3. */ -Point_3(const Kernel::Weighted_point_3 &wp); +explicit Point_3(const Kernel::Weighted_point_3 &wp); /// @} diff --git a/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_2.h b/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_2.h index f6d7dd4c201..3942237d3b4 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Weighted_point_2.h @@ -47,6 +47,9 @@ public: /*! introduces a weighted point from point `p` and weight `0`. + + \warning The `explicit` keyword is used to not have accidental implicit conversions + between Point_2 and Weighted_point_2. */ Weighted_point_2(const Point_2& p); diff --git a/Kernel_23/include/CGAL/Point_2.h b/Kernel_23/include/CGAL/Point_2.h index f86a1983c85..833388f7a4f 100644 --- a/Kernel_23/include/CGAL/Point_2.h +++ b/Kernel_23/include/CGAL/Point_2.h @@ -78,11 +78,10 @@ public: : RPoint_2(p) {} -#if 0 + explicit Point_2(const Weighted_point_2& wp) : Rep(wp.point()) {} -#endif template < typename T1, typename T2 > Point_2(const T1 &x, const T2 &y) diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index dbd2855b335..8feb1f53c7d 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -74,11 +74,12 @@ public: Point_3(const Rep& p) : Rep(p) {} -#if 0 + + explicit Point_3(const Weighted_point_3& wp) : Rep(wp.point()) {} -#endif + template < typename T1, typename T2, typename T3 > Point_3(const T1& x, const T2& y, const T3& z) : Rep(typename R::Construct_point_3()(Return_base_tag(), x, y, z)) diff --git a/Kernel_23/include/CGAL/Weighted_point_2.h b/Kernel_23/include/CGAL/Weighted_point_2.h index 43ea203c04a..a8816056483 100644 --- a/Kernel_23/include/CGAL/Weighted_point_2.h +++ b/Kernel_23/include/CGAL/Weighted_point_2.h @@ -76,7 +76,8 @@ public: Weighted_point_2(const Rep& p) : Rep(p) {} - explicit Weighted_point_2(const Point_2& p) + explicit + Weighted_point_2(const Point_2& p) : Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), p, 0)) {} diff --git a/Kernel_23/include/CGAL/Weighted_point_3.h b/Kernel_23/include/CGAL/Weighted_point_3.h index 390dcf2e2a1..649cc1d354d 100644 --- a/Kernel_23/include/CGAL/Weighted_point_3.h +++ b/Kernel_23/include/CGAL/Weighted_point_3.h @@ -78,7 +78,8 @@ public: Weighted_point_3(const Rep& p) : Rep(p) {} - explicit Weighted_point_3(const Point_3& p) + explicit + Weighted_point_3(const Point_3& p) : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), p, 0)) {}