ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved