Boost logo

Boost :

From: Matthew Wilson (stlsoft_at_[hidden])
Date: 2003-11-19 21:17:54


> > I'm still of the opinion that all a range needs is ++(), bool() and *().
> > Having said that, begin() and end() are starting to look attractive,
from a
> > practical pov. Hopefully others can shed light on where in the continuum
> > between our ideas they lie. (Perhaps they'll lie outside it! :)
> >
>
> Matt, that is not true.
> Again, I've used it in real code, where I would find an element, and had
to go
> to the previous one.
>
> // real-life code
> crange< const snapshots_array> found = rng::lower_bound( m_snapshots,
> mk_dummy_snapshot( m_current), snapshot_by_time);
> if ( found.begin() != m_snapshots.begin() )
> // go to the first element whose time is earlier than current
> --found;

Maybe. However, I would prefer to see

  if(found != xxx)

so the question is can we synthesise xxx from the rhs of the expression? I
can't make enough of your example to tell.

As I said, you're starting to win me over on the begin()/end() thing from a
practical standpoint.

Cheers

Matthew


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk