Opened 9 years ago
Closed 9 years ago
#9519 closed Bugs (fixed)
wrong results for strided, reversed range
Reported by: | Eric Niebler | Owned by: | Neil Groves |
---|---|---|---|
Milestone: | To Be Determined | Component: | range |
Version: | Boost 1.54.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The following code:
#include <vector> #include <numeric> #include <iostream> #include <boost/range/adaptor/strided.hpp> #include <boost/range/adaptor/reversed.hpp> int main() { std::vector<int> vi(50); std::iota(vi.begin(), vi.end(), 0); using namespace boost::adaptors; for(int i : vi | strided(3) | reversed) std::cout << i << ' '; std::cout << '\n'; }
Yields the following output for me:
13 10 7 4 1 0
That's whack. I don't understand it at all. I would expect it to count down from 50 by steps of 3.
Attachments (1)
Change History (5)
by , 9 years ago
Attachment: | reversed_range.cpp added |
---|
comment:2 by , 9 years ago
I don't see the point you're trying to make. Are you saying there isn't a bug?
comment:3 by , 9 years ago
Status: | new → assigned |
---|
comment:4 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
There clearly is a bug, and this particular adaptor has been problematic and suffering an unacceptable defect density. I have rewritten the adaptor and used Eric's example as a basis for a unit test. The changes are committed to the develop branch.
Note:
See TracTickets
for help on using tickets.
Correct bevhavior