Re: [boost] Re: Suggestion regarding next() and prior()
by John Torjo other posts by this author
Nov 26 2003 2:04AM messages near this date
[boost] Re: Suggestion regarding next() and prior()
|
RE: [boost] Re: safe_bool alternative?
David Abrahams wrote:
> "Walker, Daniel" <Daniel.Walker@[...].com> 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().
Best,
John
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Walker, Daniel
Fernando Cacciola
Rob Stewart
David Abrahams
David Abrahams
John Torjo
Fernando Cacciola
|