Author: andrico
Date: Wed May 27 13:47:25 2015
New Revision: 5007
URL: http://svn.gna.org/viewcvs/getfem?rev=5007&view=rev
Log:
correcting difference of iterators for const_bv_iterator
Modified:
trunk/getfem/src/getfem/dal_bit_vector.h
Modified: trunk/getfem/src/getfem/dal_bit_vector.h
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/dal_bit_vector.h?rev=5007&r1=5006&r2=5007&view=diff
==============================================================================
--- trunk/getfem/src/getfem/dal_bit_vector.h (original)
+++ trunk/getfem/src/getfem/dal_bit_vector.h Wed May 27 13:47:25 2015
@@ -397,8 +397,14 @@
return size_type(*p_iterable_);
}
+ //difference of iterators
size_type operator-(const const_bv_iterator &other) const{
- return pos_ - other.pos_;
+ if (pos_ == other.pos_) return 0;
+ auto it = (pos_ < other.pos_) ? *this : other;
+ auto end = (pos_ > other.pos_) ? *this : other;
+ size_type size = 0;
+ while(it.pos_ < end.pos_) { it++; size++;}
+ return size;
}
const const_bv_iterator &operator++(){
_______________________________________________
Getfem-commits mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-commits