$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Reid Sweatman (reids_at_[hidden])
Date: 1999-08-17 13:46:50
You're basically just describing a sentinel; why not actually implement one,
and make the container one larger on construction, with the end condition
being that you skipped to the sentinel?
> -----Original Message-----
> From: Greg Colvin [mailto:gcolvin_at_[hidden]]
> Sent: Tuesday, August 17, 1999 10:15 AM
> To: boost_at_[hidden]
> Subject: [boost] Re: SkippingIterator (Was: live_ptr => 
> live_container /
> live_iterator)
> 
> 
> > Greg Colvin wrote:
> > > 
> > > From: Valentin Bonnard <Bonnard.V_at_[hidden]>
> > > > A priori, writing a skiping iterator seems trivial:
> > > >
> > > > template <typename It, typename Predicate>
> > > > class SkippingIterator {
> > > >     mutable It pos;
> > > >     Predicate pred;
> > > >
> > > >     void skip () const
> > > >     { while (pred (*pos)) ++pos; }
> > > >
> > > > public:
> > > >     value_type& operator* () const
> > > >     { skip (); return *pos; }
> > > >
> > > >     void operator++ ()
> > > >     { skip(); ++pos; }
> > > > };
> > > >
> > > > Except that the semantic near the end is ugly (the precondition
> > > > is that there are non skipped elements before the end).
> > > 
> > > I think the precondition is just that pred(*last) is false.
> > 
> > Saying pred(*x) is false is saying that x is non skipped.
> > 
> > We are saying the same thing.
> 
> You are right.  The difference is just whether the end iterator
> is passed to the SkippingIterator constructor or the Predicate
> constructor.  Probably it would be easier for the user to pass
> it to the SkippingIterator constructor.
> 
> > This precondition is ugly (why would the elements 
> > at some position be skippable and not the others ?)
> 
> So you don't skip off the end of the sequence.  There is no
> element to skip at the end.
> 
> 
> --------------------------------------------------------------
> ----------
> Just Tell Us What You Want...
> Respond.com - Shopping the World for You!
> http://clickhere.egroups.com/click/738
> 
> 
> eGroups.com home: http://www.egroups.com/group/boost
> http://www.egroups.com - Simplifying group communications
> 
> 
> 
>