$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2003-11-26 07:38:10
John Torjo <john.lists_at_[hidden]> wrote in message news:3FC40A3E.6000705_at_torjo.com...
>
>
> David Abrahams wrote:
> > "Walker, Daniel" <Daniel.Walker_at_[hidden]> writes:
> >
> >
> >>template <class T, class Size>
> >>inline T next_n(T x, Size n)
> >>{
> >> std::advance(x, n);
> >> return x;
> >>}
> >>
> >>template <class T, class Size>
> >>inline T prior_n(T x, Size n)
> >>{
> >> std::advance(x, -n);
> >> return x;
> >>}
> >>
> > [...]
> > Seems reasonable to me, though I'd tend to call them next and prior.
> >
>
> Indeed, there are different overloads.
> So if you want next(iterator) it increments (by one), and if you need a specific
> size, just use next(iterator,size).
>
> Same goes for prior().
>
What I have in my pocket which worked pretty well for me is:
advanced(it,size)
notice the 'd' in advanceD, and the fact that size can be either possitive or negative
HTH
Fernando Cacciola
SciSoft