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