On 10/10/15 12:58 AM, Eric Niebler wrote:
Trying to express algorithms without any clear abstraction of "position within range" (independent of ranges) is hard and awkward, and occasionally causes algorithms to be less efficient.
I agree that ranges are a weaker basis than iterators. But it's not necessarily that a notion of position is the only way out.
Ranges can be made as strong a basis by adding the O(1) primitives r1.before(r2) and r1.after(r2) that return the prefix/suffix following r2 within r1. With those I hope to be able to show easily that algorithms needing "iterator in the middle" can be redone.
I think I need to sit down and define these primitives (albeit they aren't used that frequently) and use them in a few fundamental algorithms to just close the matter once and for all.
Andrei