|
Boost : |
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2003-12-02 14:53:01
"AlisdairM" <alisdair.meredith_at_[hidden]> escribió en el mensaje
news:Xns9445C4EBA2ED6alisdairmeredithukre_at_80.91.224.252...
> Rob Stewart <stewart_at_[hidden]> wrote in news:200312021902.hB2J2Ri22303
> @entwistle.systems.susq.com:
>
>
> > I've seen you mention this elsewhere, but I don't get it. Adding
> > the "d" makes the past tense of the verb, so when you call the
> > function, it will have already advanced the iterator, leaving me
> > to wonder what the call actually does. IOW, how does temporal
> > mechanics fit with advancing by some number of steps? ;-) (My
> > point is that adding the "d" doesn't connote advancing by some
> > number of steps.)
>
> advance is an imperativ, a command, and indicates it will change the state
> of the passed iterator. advanceD describes the state of what is
returned,
> a different iterator to the one passed.
>
Exactly.
The name is choosen with a focus on the _expression_ that results.
> That said, I prefer the idea of overloading next and prior. <g>
>
> AlisdairM
>
I understand that reusing the names is important.
The only issue I have with the overlading approach is that in my experience
with advanced(), the number of steps is often given as a variable with the
sign somewhat hidden, that is, you don't _lexically_ know if you're moving
forward or backward. In such a context, a call to 'next' with negative
values, or 'prior' with positive values, might be misleading.
Fernando Cacciola
SciSoft
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk