mirror of https://github.com/CGAL/cgal
swap for Point_2 and Point_d
and make the implementations more similar, in case someone wants to replace it with a macro at some point.
This commit is contained in:
parent
1eed5a908c
commit
3ebe8839b6
|
|
@ -50,6 +50,15 @@ public:
|
|||
PointC2(const FT &hx, const FT &hy, const FT &hw)
|
||||
: base(hx, hy, hw) {}
|
||||
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Vector_2_>)
|
||||
#endif
|
||||
{
|
||||
using std::swap;
|
||||
swap(a.base, b.base);
|
||||
}
|
||||
|
||||
const FT& x() const
|
||||
{
|
||||
return base.x();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ namespace CGAL {
|
|||
template < class R_ >
|
||||
class PointC3
|
||||
{
|
||||
typedef PointC3<R_> Self;
|
||||
typedef typename R_::Vector_3 Vector_3;
|
||||
typedef typename R_::Point_3 Point_3;
|
||||
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
|
||||
|
|
@ -47,7 +48,7 @@ public:
|
|||
PointC3(const FT &x, const FT &y, const FT &z, const FT &w)
|
||||
: base(x, y, z, w) {}
|
||||
|
||||
friend void swap(PointC3& a, PointC3& b)
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Vector_3>)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ namespace CGAL {
|
|||
template < class R_ >
|
||||
class VectorC2
|
||||
{
|
||||
typedef VectorC2<R_> Self;
|
||||
typedef typename R_::FT FT;
|
||||
typedef typename R_::Point_2 Point_2;
|
||||
typedef typename R_::Vector_2 Vector_2;
|
||||
|
|
@ -55,6 +56,15 @@ public:
|
|||
: base( hw != FT(1) ? CGAL::make_array<FT>(hx/hw, hy/hw)
|
||||
: CGAL::make_array(hx, hy) ) {}
|
||||
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Base>)
|
||||
#endif
|
||||
{
|
||||
using std::swap;
|
||||
swap(a.base, b.base);
|
||||
}
|
||||
|
||||
const FT & x() const
|
||||
{
|
||||
return CGAL::get_pointee_or_identity(base)[0];
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ template < class R_ >
|
|||
class VectorC3
|
||||
{
|
||||
// https://doc.cgal.org/latest/Manual/devman_code_format.html#secprogramming_conventions
|
||||
typedef VectorC3<R_> Self;
|
||||
typedef typename R_::FT FT_;
|
||||
typedef typename R_::Point_3 Point_3;
|
||||
typedef typename R_::Vector_3 Vector_3;
|
||||
|
|
@ -70,7 +71,7 @@ public:
|
|||
: base( w != FT_(1) ? CGAL::make_array<FT_>(x/w, y/w, z/w)
|
||||
: CGAL::make_array(x, y, z) ) {}
|
||||
|
||||
friend void swap(VectorC3& a, VectorC3& b)
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Base>)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ public:
|
|||
typedef RPoint_2 Rep;
|
||||
typedef typename R_::Cartesian_const_iterator_2 Cartesian_const_iterator;
|
||||
|
||||
const Rep& rep() const
|
||||
const Rep& rep() const noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rep& rep()
|
||||
Rep& rep() noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -84,6 +84,15 @@ public:
|
|||
: RPoint_2(typename R::Construct_point_2()(Return_base_tag(), hx, hy, hw))
|
||||
{}
|
||||
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Rep>)
|
||||
#endif
|
||||
{
|
||||
using std::swap;
|
||||
swap(a.rep(), b.rep());
|
||||
}
|
||||
|
||||
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
|
||||
x() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public:
|
|||
: Rep(typename R::Construct_point_3()(Return_base_tag(), hx, hy, hz, hw))
|
||||
{}
|
||||
|
||||
friend void swap(Point_3& a, Point_3& b)
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Rep>)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ public:
|
|||
typedef RVector_2 Rep;
|
||||
typedef typename R_::Cartesian_const_iterator_2 Cartesian_const_iterator;
|
||||
|
||||
const Rep& rep() const
|
||||
const Rep& rep() const noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rep& rep()
|
||||
Rep& rep() noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -93,6 +93,15 @@ public:
|
|||
Vector_2(const RT &x, const RT &y, const RT &w)
|
||||
: RVector_2(typename R::Construct_vector_2()(Return_base_tag(), x,y,w)) {}
|
||||
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Rep>)
|
||||
#endif
|
||||
{
|
||||
using std::swap;
|
||||
swap(a.rep(), b.rep());
|
||||
}
|
||||
|
||||
|
||||
typename cpp11::result_of<typename R::Compute_x_2(Vector_2)>::type
|
||||
x() const
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public:
|
|||
Vector_3(const RT& x, const RT& y, const RT& z, const RT& w)
|
||||
: Rep(typename R::Construct_vector_3()(Return_base_tag(), x, y, z, w)) {}
|
||||
|
||||
friend void swap(Vector_3& a, Vector_3& b)
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Rep>)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,12 +51,12 @@ public:
|
|||
typedef typename Get_type<Kbase, Point_tag>::type Rep;
|
||||
//typedef typename CGAL::decay<typename boost::result_of<CPI(Rep,Begin_tag)>::type>::type Cartesian_const_iterator;
|
||||
|
||||
const Rep& rep() const
|
||||
const Rep& rep() const noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rep& rep()
|
||||
Rep& rep() noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -101,6 +101,14 @@ public:
|
|||
Point_d(Origin&& v)
|
||||
: Rep(CPBase()(std::move(v))) {}
|
||||
|
||||
friend void swap(Self& a, Self& b)
|
||||
#ifdef __cpp_lib_is_swappable
|
||||
noexcept(std::is_nothrow_swappable_v<Rep>)
|
||||
#endif
|
||||
{
|
||||
using std::swap;
|
||||
swap(a.rep(), b.rep());
|
||||
}
|
||||
|
||||
decltype(auto) cartesian(int i)const{
|
||||
return CCBase()(rep(),i);
|
||||
|
|
|
|||
Loading…
Reference in New Issue