Boost logo

Boost Users :

Subject: Re: [Boost-users] Iterator Range, sub range of a desired size
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2012-10-29 08:14:49


On 29-10-2012 08:33, Neil Groves wrote:
>
> On Mon, Oct 29, 2012 at 4:40 AM, David Kimmel <davidwkimmel_at_[hidden]
> <mailto:davidwkimmel_at_[hidden]>> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net