-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Bug in ValueIteratorBase::operator- #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ugh! You're right, but look at this:
I think Baptiste only tested his iterators with CPPTL. Now we need to reverse line 80 also. Fortunately, it is called only via the code which you have fixed, so we can safely reverse line 80 too. Unfortunately, that is I'll change line 80, add a test, and keep your commit... |
Fix bug in ValueIteratorBase::operator- Fixes #169.
* Bug-fix for ValueIterator::operator-() (issue #169)
Why the distance can't be negative? |
ValueIteratorBase::operator-
implementation appears to be backwards. It callsthis->computeDistance(other)
andcomputeDistance
expects thatother
is reachable fromthis
(i.e.other >= this
). But with iteratorsit1 - it2
generally implies that it1 is reachable from it2. Hence the following usage does not work as expected.Repro
Expected result
Actual result
The text was updated successfully, but these errors were encountered: