mirror of https://github.com/CGAL/cgal
correct bug in postfix++ of interator in incremental neighbor search methods
This commit is contained in:
parent
677fa29eb8
commit
26e4e3ae68
|
|
@ -127,6 +127,15 @@ namespace CGAL {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct Object_wrapper
|
||||||
|
{
|
||||||
|
T object;
|
||||||
|
Object_wrapper(const T& t):object(t){}
|
||||||
|
const T& operator* () const { return object; }
|
||||||
|
const T* operator-> () const { return &object; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class iterator {
|
class iterator {
|
||||||
|
|
||||||
|
|
@ -185,11 +194,10 @@ namespace CGAL {
|
||||||
}
|
}
|
||||||
|
|
||||||
// postfix operator
|
// postfix operator
|
||||||
iterator operator++(int)
|
Object_wrapper<Point_with_transformed_distance>
|
||||||
|
operator++(int)
|
||||||
{
|
{
|
||||||
iterator tmp(*this);
|
return (*ptr)++;
|
||||||
++(*this);
|
|
||||||
return tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -349,7 +357,15 @@ namespace CGAL {
|
||||||
Compute_the_next_nearest_neighbour();
|
Compute_the_next_nearest_neighbour();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// postfix operator
|
||||||
|
Object_wrapper<Point_with_transformed_distance>
|
||||||
|
operator++(int)
|
||||||
|
{
|
||||||
|
Object_wrapper<Point_with_transformed_distance> result( *(Item_PriorityQueue.top()) );
|
||||||
|
++*this;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Print statistics of the general priority search process.
|
// Print statistics of the general priority search process.
|
||||||
std::ostream&
|
std::ostream&
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,14 @@ namespace CGAL {
|
||||||
typedef std::vector<Node_with_distance*> Node_with_distance_vector;
|
typedef std::vector<Node_with_distance*> Node_with_distance_vector;
|
||||||
typedef std::vector<Point_with_transformed_distance*> Point_with_transformed_distance_vector;
|
typedef std::vector<Point_with_transformed_distance*> Point_with_transformed_distance_vector;
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct Object_wrapper
|
||||||
|
{
|
||||||
|
T object;
|
||||||
|
Object_wrapper(const T& t):object(t){}
|
||||||
|
const T& operator* () const { return object; }
|
||||||
|
const T* operator-> () const { return &object; }
|
||||||
|
};
|
||||||
|
|
||||||
class Iterator_implementation {
|
class Iterator_implementation {
|
||||||
|
|
||||||
|
|
@ -172,10 +179,10 @@ namespace CGAL {
|
||||||
}
|
}
|
||||||
|
|
||||||
// postfix operator
|
// postfix operator
|
||||||
Point_with_transformed_distance
|
Object_wrapper<Point_with_transformed_distance>
|
||||||
operator++(int)
|
operator++(int)
|
||||||
{
|
{
|
||||||
Point_with_transformed_distance result = *(Item_PriorityQueue.top());
|
Object_wrapper<Point_with_transformed_distance> result( *(Item_PriorityQueue.top()) );
|
||||||
++*this;
|
++*this;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -200,12 +207,12 @@ namespace CGAL {
|
||||||
//destructor
|
//destructor
|
||||||
~Iterator_implementation()
|
~Iterator_implementation()
|
||||||
{
|
{
|
||||||
while (PriorityQueue.size()>0) {
|
while (!PriorityQueue.empty()) {
|
||||||
Node_with_distance* The_top=PriorityQueue.top();
|
Node_with_distance* The_top=PriorityQueue.top();
|
||||||
PriorityQueue.pop();
|
PriorityQueue.pop();
|
||||||
delete The_top;
|
delete The_top;
|
||||||
}
|
}
|
||||||
while (Item_PriorityQueue.size()>0) {
|
while (!Item_PriorityQueue.empty()) {
|
||||||
Point_with_transformed_distance* The_top=Item_PriorityQueue.top();
|
Point_with_transformed_distance* The_top=Item_PriorityQueue.top();
|
||||||
Item_PriorityQueue.pop();
|
Item_PriorityQueue.pop();
|
||||||
delete The_top;
|
delete The_top;
|
||||||
|
|
@ -436,12 +443,10 @@ namespace CGAL {
|
||||||
}
|
}
|
||||||
|
|
||||||
// postfix operator
|
// postfix operator
|
||||||
iterator
|
Object_wrapper<Point_with_transformed_distance>
|
||||||
operator++(int)
|
operator++(int)
|
||||||
{
|
{
|
||||||
iterator tmp(*this);
|
return (*Ptr_implementation)++;
|
||||||
++(*this);
|
|
||||||
return tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue