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 {
|
||||
|
||||
|
|
@ -185,11 +194,10 @@ namespace CGAL {
|
|||
}
|
||||
|
||||
// postfix operator
|
||||
iterator operator++(int)
|
||||
Object_wrapper<Point_with_transformed_distance>
|
||||
operator++(int)
|
||||
{
|
||||
iterator tmp(*this);
|
||||
++(*this);
|
||||
return tmp;
|
||||
return (*ptr)++;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -349,7 +357,15 @@ namespace CGAL {
|
|||
Compute_the_next_nearest_neighbour();
|
||||
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.
|
||||
std::ostream&
|
||||
|
|
|
|||
|
|
@ -50,7 +50,14 @@ namespace CGAL {
|
|||
typedef std::vector<Node_with_distance*> Node_with_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 {
|
||||
|
||||
|
|
@ -172,10 +179,10 @@ namespace CGAL {
|
|||
}
|
||||
|
||||
// postfix operator
|
||||
Point_with_transformed_distance
|
||||
Object_wrapper<Point_with_transformed_distance>
|
||||
operator++(int)
|
||||
{
|
||||
Point_with_transformed_distance result = *(Item_PriorityQueue.top());
|
||||
Object_wrapper<Point_with_transformed_distance> result( *(Item_PriorityQueue.top()) );
|
||||
++*this;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -200,12 +207,12 @@ namespace CGAL {
|
|||
//destructor
|
||||
~Iterator_implementation()
|
||||
{
|
||||
while (PriorityQueue.size()>0) {
|
||||
while (!PriorityQueue.empty()) {
|
||||
Node_with_distance* The_top=PriorityQueue.top();
|
||||
PriorityQueue.pop();
|
||||
delete The_top;
|
||||
}
|
||||
while (Item_PriorityQueue.size()>0) {
|
||||
while (!Item_PriorityQueue.empty()) {
|
||||
Point_with_transformed_distance* The_top=Item_PriorityQueue.top();
|
||||
Item_PriorityQueue.pop();
|
||||
delete The_top;
|
||||
|
|
@ -436,12 +443,10 @@ namespace CGAL {
|
|||
}
|
||||
|
||||
// postfix operator
|
||||
iterator
|
||||
Object_wrapper<Point_with_transformed_distance>
|
||||
operator++(int)
|
||||
{
|
||||
iterator tmp(*this);
|
||||
++(*this);
|
||||
return tmp;
|
||||
return (*Ptr_implementation)++;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue