Opened 13 years ago
Last modified 13 years ago
#643 new request
Circular Iterator Adaptor
Reported by: | Peter | Owned by: | Jari Häkkinen |
---|---|---|---|
Priority: | major | Milestone: | yat 0.x+ |
Component: | utility | Version: | trunk |
Keywords: | Cc: |
Description
This iterator should work exactly as its base iterator with the difference that when it increments to the end of the container we gets to the begin instead.
For example if I have a vector(100) I wanna be able to iterate from vector.begin()+50
all the way to the end, continue from the beginning and end at e.g. at vector.begin()+50
. This should be possible via
algorithm(CIT(vector.begin()+50), CIT(vector.begin()+50));
The adaptor probably needs to hold a reference to the container but I leave those decisions for later.
Note: See
TracTickets for help on using
tickets.
There's clearly an issue with the suggested code in description. In
argument one and argument two are equal, and since many algorithms are like
the while loop would exit immediately instead of acting on the range.