More swap

We could add it for all kernel wrappers...
It is really inconvenient that swap cannot be autogenerated like move
assignments are.
noexcept(auto) would also be convenient, whatever some people on the
committee claim.
This commit is contained in:
Marc Glisse 2020-02-25 01:52:19 +01:00
parent 3e4c0d28e5
commit c92587fb9c
1 changed files with 11 additions and 2 deletions

View File

@ -46,12 +46,12 @@ public:
typedef typename R_::Kernel_base::Point_3 Rep;
typedef typename R_::Cartesian_const_iterator_3 Cartesian_const_iterator;
const Rep& rep() const
const Rep& rep() const noexcept
{
return *this;
}
Rep& rep()
Rep& rep() noexcept
{
return *this;
}
@ -81,6 +81,15 @@ public:
: Rep(typename R::Construct_point_3()(Return_base_tag(), hx, hy, hz, hw))
{}
friend void swap(Point_3& a, Point_3& 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_3( Point_3)>::type
x() const
{