summaryrefslogtreecommitdiff
path: root/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-10-04 18:07:42 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-10-04 18:07:42 +0000
commite6992894cf4e9b76acee98e2c1ad840a3ebd7274 (patch)
treed4057926670ae3363e114d391b3e777690505bda /src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h
parent350b400fa0fb49c190b5b62934fa58869f23f4c4 (diff)
Fixed a major bug in the Active_witness_iterator
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1633 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: d4f474b44835b11e65a152f9d3fe87cc32b527f5
Diffstat (limited to 'src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h')
-rw-r--r--src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h
index 658405f6..5d4f3d75 100644
--- a/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h
+++ b/src/Witness_complex/include/gudhi/Active_witness/Active_witness_iterator.h
@@ -64,7 +64,7 @@ public:
private :
- Id_distance_pair dereference() const
+ Id_distance_pair& dereference() const
{
return *lh_;
}
@@ -76,9 +76,17 @@ private :
void increment()
{
+ // if neighbor search is at its end, check if lh_++ is end
+ if (aw_->iterator_last_ == aw_->iterator_end_) {
+ if (lh_++ == aw_->nearest_landmark_table_.end()) {
+ lh_ = aw_->end_pointer;
+ return;
+ }
+ return;
+ }
// if the id of the current landmark is the same as the last one
if (lh_->first == aw_->iterator_last_->first) {
- // if the next iterator is end, lh_it = nullptr
+ // if the next iterator is end, lh_it = end pointer
if (++(aw_->iterator_last_) == aw_->iterator_end_) {
lh_ = aw_->end_pointer;
return;