mirror of https://github.com/CGAL/cgal
I forgot Triangulation_hierarchy_3 (Fast_location)!
Note that a move-from object of class `Triangulation_hierarchy_3` is not really valid. I have just verified that it can be destroyed. Even a call to `clear()` on a moved-from hierarchy will segfault! To be fixed later...
This commit is contained in:
parent
b311ab59ed
commit
290c3a2011
|
|
@ -51,6 +51,8 @@
|
|||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
#endif //CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -92,7 +94,7 @@ public:
|
|||
private:
|
||||
|
||||
// here is the stack of triangulations which form the hierarchy
|
||||
Tr_Base* hierarchy[maxlevel];
|
||||
std::array<Tr_Base*,maxlevel> hierarchy;
|
||||
boost::rand48 random;
|
||||
|
||||
void set_up_down(Vertex_handle up, Vertex_handle down)
|
||||
|
|
@ -107,6 +109,18 @@ public:
|
|||
|
||||
Triangulation_hierarchy_3(const Triangulation_hierarchy_3& tr);
|
||||
|
||||
Triangulation_hierarchy_3(Triangulation_hierarchy_3&& other)
|
||||
noexcept( noexcept(Tr_Base(std::move(other))) )
|
||||
: Tr_Base(std::move(other))
|
||||
, random(std::move(other.random))
|
||||
{
|
||||
hierarchy[0] = this;
|
||||
for(int i=1; i<maxlevel; ++i) {
|
||||
hierarchy[i] = other.hierarchy[i];
|
||||
other.hierarchy[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
template < typename InputIterator >
|
||||
Triangulation_hierarchy_3(InputIterator first, InputIterator last,
|
||||
const Geom_traits& traits = Geom_traits())
|
||||
|
|
@ -125,9 +139,30 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
~Triangulation_hierarchy_3();
|
||||
Triangulation_hierarchy_3 & operator=(Triangulation_hierarchy_3&& tr)
|
||||
noexcept( noexcept(Triangulation_hierarchy_3(std::move(tr))) &&
|
||||
noexcept(this->swap(std::declval<Triangulation_hierarchy_3&>())) )
|
||||
{
|
||||
Triangulation_hierarchy_3 tmp(std::move(tr));
|
||||
swap(tmp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(Triangulation_hierarchy_3 &tr);
|
||||
~Triangulation_hierarchy_3()
|
||||
{
|
||||
clear();
|
||||
for(int i=1; i<maxlevel; ++i) {
|
||||
delete hierarchy[i];
|
||||
}
|
||||
};
|
||||
|
||||
void swap(Triangulation_hierarchy_3 &tr)
|
||||
noexcept(noexcept(this->Tr_Base::swap(tr)))
|
||||
{
|
||||
Tr_Base::swap(tr);
|
||||
for(int i=1; i<maxlevel; ++i)
|
||||
std::swap(hierarchy[i], tr.hierarchy[i]);
|
||||
};
|
||||
|
||||
void clear();
|
||||
|
||||
|
|
@ -462,26 +497,6 @@ Triangulation_hierarchy_3(const Triangulation_hierarchy_3<Tr> &tr)
|
|||
}
|
||||
}
|
||||
|
||||
template <class Tr>
|
||||
void
|
||||
Triangulation_hierarchy_3<Tr>::
|
||||
swap(Triangulation_hierarchy_3<Tr> &tr)
|
||||
{
|
||||
Tr_Base::swap(tr);
|
||||
for(int i=1; i<maxlevel; ++i)
|
||||
std::swap(hierarchy[i], tr.hierarchy[i]);
|
||||
}
|
||||
|
||||
template <class Tr>
|
||||
Triangulation_hierarchy_3<Tr>::
|
||||
~Triangulation_hierarchy_3()
|
||||
{
|
||||
clear();
|
||||
for(int i=1; i<maxlevel; ++i) {
|
||||
delete hierarchy[i];
|
||||
}
|
||||
}
|
||||
|
||||
template <class Tr>
|
||||
void
|
||||
Triangulation_hierarchy_3<Tr>::
|
||||
|
|
|
|||
Loading…
Reference in New Issue