
On 10/29/2012 8:14 AM, Thorsten Ottosen wrote:
On 29-10-2012 08:33, Neil Groves wrote:
On Mon, Oct 29, 2012 at 4:40 AM, David Kimmel
mailto:davidwkimmel@gmail.com> wrote: Is there a function in BOOST, given a starting point and a desired size, that returns iterators for a (sub) range?
There are two classes in Boost.Range that achieve this purpose. The first, boost::iterator_range<Iterator> can be used to hold sub-ranges. It is not directly constructible from the form firstIterator, count since this would either require that the Iterator is a model of the RandomAccessConcept or would provide sloppy performance guarantees.
We could consider to add an make_iterator_range which took the count, and then make a static assertion about random access iterators. It seems to me that iterator + count is a quite normal way of creating a range.
-Thorsten
The 'sliced' adaptor is almost there, with it's begin/end indices. http://www.boost.org/doc/libs/1_51_0/libs/range/doc/html/range/reference/ada... Jeff