Boost logo

Boost :

Subject: Re: [boost] [iterators] Proof-of-concept for a sentinel iterator adapter
From: Beman Dawes (bdawes_at_[hidden])
Date: 2009-05-13 17:49:47

On Wed, May 13, 2009 at 5:30 PM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
> Beman Dawes wrote:
>> Attached is proof-of-concept code for a sentinel iterator adapter.
> This is not a true iterator adapter, since it can only adapt an iterator of
> pointer type, not just any iterator.
>> Would a production version of this iterator adapter be a worthwhile
>> addition to Boost.Iterators?
> I suggest turning it into a true iterator adapter that would apply a
> predicate on each element to tell whether it is the end.

Yes, that's one of the approaches I considered.

One issue with that approach is that optimizers can't always see into
function objects. Although C++0x Lambda will fix that, at least for
some compilers, the predicate adds a bit of complexity to an otherwise
very simple specification.

It may be worthwhile to have several sentinel iterators. The dust
needs to settle a bit, then we can sort out what is actually worth


Boost list run by bdawes at, gregod at, cpdaniel at, john at