Boost logo

Boost :

From: Nemanja Trifunovic (nemanja_trifunovic_at_[hidden])
Date: 2006-12-14 08:10:46


David Abrahams <dave <at> boost-consulting.com> writes:

>
> Anthony Williams <anthony_w.geo <at> yahoo.com> writes:
>
> > Nemanja Trifunovic <nemanja_trifunovic <at> yahoo.com> writes:
> >
> >>> Just because the vast majority of sequences will be random access
doesn't
> >> mean
> >>> we should limit ourselves to that, when it is so easy to allow the use of
> >>> Forward Iterators.
> >>>
> >>
> >> Bidirectional maybe, but using a forward iterator would break some
important
> >> functionality: for instance, if an invalid sequence is detected, we step
back
> >> to the beginning of the sequence before reporting the error.
> >
> > Forward Iterators are copyable, so you can do this by keeping a copy of the
> > beginning of the sequence, and returning that on error.
>
> Yeah, I *hope* you'd do the same with bidirectional iterators.
>

Sorry for the late answer.

Not in this case. "Stepping back" occurs only in case of an invalid UTF-8
sequence which is an exceptional case. If we decide to keep a copy of the
iterator, we would need to do it for each function call.


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