|
Boost : |
From: Walker, Daniel (Daniel.Walker_at_[hidden])
Date: 2003-11-26 15:08:55
David Abrahams [mailto:dave_at_[hidden]] wrote:
> John Torjo <john.lists_at_[hidden]> writes:
>
> > 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().
>
> Daniel, if you submit implementation, doc, and test patches
> I'd be happy to apply them. I've definitely wanted this
> capability myself a few times.
>
OK, will do. I'll try to get to it over the weekend.
And yes, good point on the names. There's no real reason to give them
different names. I'll just overload next() and prior().
Thanks!
_________________________________
Daniel Walker, Software Engineer
Bowne Global Solutions
Office 5095 Murphy Canyon Road
San Diego, CA 92101 USA
Phone +1 858 737 5247
Mobile +1 619 251 4068
Fax +1 858 737 5297
daniel.walker_at_[hidden]
www.bowneglobal.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk