mirror of https://github.com/CGAL/cgal
Less use of swap
This commit is contained in:
parent
20bb2c8428
commit
4261d4635b
|
|
@ -65,9 +65,8 @@ public:
|
|||
|
||||
Delaunay_triangulation_cell_base_with_circumcenter_3
|
||||
(Delaunay_triangulation_cell_base_with_circumcenter_3 &&c)
|
||||
: Cb(std::move(c)), circumcenter_(nullptr)
|
||||
: Cb(std::move(c)), circumcenter_(std::exchange(c.circumcenter_, nullptr))
|
||||
{
|
||||
std::swap(circumcenter_, c.circumcenter_);
|
||||
}
|
||||
|
||||
Delaunay_triangulation_cell_base_with_circumcenter_3&
|
||||
|
|
@ -81,8 +80,8 @@ public:
|
|||
Delaunay_triangulation_cell_base_with_circumcenter_3&
|
||||
operator=(Delaunay_triangulation_cell_base_with_circumcenter_3 &&c)
|
||||
{
|
||||
Delaunay_triangulation_cell_base_with_circumcenter_3 tmp=std::move(c);
|
||||
std::swap(tmp, *this);
|
||||
Cb::operator=(std::move(c));
|
||||
circumcenter_ = std::exchange(c.circumcenter_, nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,14 +205,13 @@ public:
|
|||
void swap(Regular_triangulation_3& tr)
|
||||
noexcept(noexcept(this->Tr_Base::swap(tr)))
|
||||
{
|
||||
// The 'vertices' and 'hidden_points' members of 'hidden_point_visitor' should be empty
|
||||
// as they are only filled (and cleared) during the insertion of a point.
|
||||
// Hidden points are not stored there, but rather in cells. Thus, the only thing that must be set
|
||||
// is the triangulation pointer.
|
||||
Hidden_point_visitor<Concurrency_tag> new_hpv(this);
|
||||
using std::swap;
|
||||
swap(hidden_point_visitor, new_hpv);
|
||||
|
||||
// The 'vertices' and 'hidden_points' members of
|
||||
// 'hidden_point_visitor' should be empty as they are only filled
|
||||
// (and cleared) during the insertion of a point. Hidden points
|
||||
// are not stored there, but rather in cells. Thus, the only thing
|
||||
// that must be set is the triangulation pointer, and it is
|
||||
// already correctly set. There is nothing to do about
|
||||
// 'hidden_point_visitor'.
|
||||
Tr_Base::swap(tr);
|
||||
}
|
||||
|
||||
|
|
@ -224,11 +223,9 @@ public:
|
|||
}
|
||||
|
||||
Regular_triangulation_3& operator=(Regular_triangulation_3&& tr)
|
||||
noexcept(noexcept(Regular_triangulation_3(std::move(tr))) &&
|
||||
noexcept(std::declval<Regular_triangulation_3>().swap(*this)))
|
||||
noexcept(noexcept(Regular_triangulation_3(std::move(tr))))
|
||||
{
|
||||
Regular_triangulation_3 copy(std::move(tr));
|
||||
copy.swap(*this);
|
||||
Tr_Base::operator=(std::move(tr));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue