On Tue, Oct 30, 2012 at 11:03 PM, David Kimmel <davidwkimmel@gmail.com> wrote:
Understood.  I was just wondering if the two issues you raised about using distance hinted at a possible better solution.  


If one needs to solve this for iterators that are not random access I see two approaches:
1. Augment your container structure that produces the initial range to track the distance between the range you are building. This might or might not make any sense at all depending on the container and the requirements upon the sub-range.
2. Augment/wrap the iterators so that the wrapped iterator satisfies more requirements than a ForwardIterator by being able to calculate the distance in O(1). This can be achieved by maintaining an additional index. The wrapped iterator would still not model the RandomAccessIterator Concept since it would not need to provide O(1) advance etc.
 
Each of these is probably too much additional work until a concrete use-case presents itself.

Yes, at this point though the solution (make_iterator_range, next, distance, with two ranges) completely satisfies the problem.  It is definitely a RandomAccessRange type problem.  

Sweet.
 
Thanks to everyone.


You are very welcome. Thanks for your patience with my slow understanding of the problem.

Regards,
Neil Groves