mirror of https://github.com/CGAL/cgal
example of perfect forwarding for Point_3
This commit is contained in:
parent
1d5f57ebb7
commit
8a5fc31c6c
|
|
@ -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<FT>(x), std::forward<FT>(y), std::forward<FT>(z))
|
||||
{}
|
||||
|
||||
|
||||
PointC3(const FT &x, const FT &y, const FT &z, const FT &w)
|
||||
: base(x, y, z, w) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<FT_>(x/w, y/w, z/w)
|
||||
|
|
|
|||
|
|
@ -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<RT>(x), std::forward<RT>(y), std::forward<RT>(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<RT>(x), std::forward<RT>(y), std::forward<RT>(z)); }
|
||||
|
||||
Point_3
|
||||
operator()(const RT& x, const RT& y, const RT& z, const RT& w) const
|
||||
{ return Point_3(x, y, z, w); }
|
||||
|
|
|
|||
|
|
@ -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<T1>(x),
|
||||
std::forward<T2>(y),
|
||||
std::forward<T3>(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<R>& p, const Cartesian_tag&)
|
|||
break;
|
||||
}
|
||||
if (is)
|
||||
p = Point_3<R>(x, y, z);
|
||||
p = Point_3<R>(std::move(x), std::move(y), std::move(z));
|
||||
return is;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue