diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h index 1bd80cdb016..205a9af6346 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h @@ -45,6 +45,11 @@ public: PointC3(const FT &x, const FT &y, const FT &z) : base(x, y, z) {} + PointC3(FT &&x, FT &&y, FT &&z) + : base(std::forward(x), std::forward(y), std::forward(z)) + {} + + PointC3(const FT &x, const FT &y, const FT &z, const FT &w) : base(x, y, z, w) {} diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index 5b03e8d0fb3..55862b39bc8 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -65,7 +65,10 @@ public: { *this = R().construct_vector_3_object()(l); } VectorC3(const FT_ &x, const FT_ &y, const FT_ &z) - : base(CGAL::make_array(x, y, z)) {} + : base(Rep{x, y, z}) {} + + VectorC3(FT_ &&x, FT_ &&y, FT_ &&z) + : base(Rep{x, y, z}) {} VectorC3(const FT_ &x, const FT_ &y, const FT_ &z, const FT_ &w) : base( w != FT_(1) ? CGAL::make_array(x/w, y/w, z/w) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 737a52dfc14..effe3bf68a9 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -3160,6 +3160,10 @@ namespace CartesianKernelFunctors { operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const { return Rep(x, y, z); } + Rep // Point_3 + operator()(Return_base_tag, RT&& x, RT&& y, RT&& z) const + { return Rep(std::forward(x), std::forward(y), std::forward(z)); } + Rep // Point_3 operator()(Return_base_tag, const RT& x, const RT& y, const RT& z, const RT& w) const { return Rep(x, y, z, w); } @@ -3180,6 +3184,10 @@ namespace CartesianKernelFunctors { operator()(const RT& x, const RT& y, const RT& z) const { return Point_3(x, y, z); } + Point_3 + operator()(RT&& x, RT&& y, RT&& z) const + { return Point_3(std::forward(x), std::forward(y), std::forward(z)); } + Point_3 operator()(const RT& x, const RT& y, const RT& z, const RT& w) const { return Point_3(x, y, z, w); } diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 03d00f78f3f..127e7746089 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -79,6 +79,13 @@ public: : Rep(typename R::Construct_point_3()(Return_base_tag(), x, y, z)) {} + template < typename T1, typename T2, typename T3 > + Point_3(T1&& x, T2&& y, T3&& z) + : Rep(typename R::Construct_point_3()(Return_base_tag(), std::forward(x), + std::forward(y), + std::forward(z))) + {} + Point_3(const RT& hx, const RT& hy, const RT& hz, const RT& hw) : Rep(typename R::Construct_point_3()(Return_base_tag(), hx, hy, hz, hw)) {} @@ -283,7 +290,7 @@ extract(std::istream& is, Point_3& p, const Cartesian_tag&) break; } if (is) - p = Point_3(x, y, z); + p = Point_3(std::move(x), std::move(y), std::move(z)); return is; }