Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2003-05-07 06:34:48

Sylvain Pion wrote:
> On Tue, May 06, 2003 at 08:48:51PM -0400, David Abrahams wrote:
>>>I was wondering why the filter_iterator could not be made
>>>bidirectional when the base iterator is as well.
>>It could, for a (rather high) price.
>>>Is it because it would have to store the "begin" iterator ?
>>>Actually I am wondering whether it should have to store the begin iterator
>>>even in this case.
>>Yes, it would.
>>>Would it be possible to make filter_iterator support operator-- ?
>>Yes it would. It seems like a fun project for someone so inclined ;-)
>>Do you need this functionality for something, or are you just curious?
> I need it. I have independently implemented a version of it in CGAL
> quite some time ago, and I'm comparing it to Boost's version now.
> Mine has to be bidirectional, so I store the "begin" base iterator.
> But I was wondering if I could do without, because the only reason for storing
> the begin base iterator is just to detect when the user calls operator-- on the
> begin() of the resulting filter iterator.
> But is this something which really has to be guarded against, or is this just
> something which can be left unspecified (i.e. it's a user bug) ?

I tend to agree. Decrementing the begin iterator is never save nor are
there any guards in the standard library.


Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet 
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001

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