Boost logo

Boost :

From: Bernard (yahoo_at_[hidden])
Date: 2003-11-21 11:15:57


Le Vendredi 21 Novembre 2003 04:19, Michael Hart a écrit :
> > > some_range_type r(. . .);
> > >
> > > for(; r; ++r)
> > > {
> > > *r; // Do something with the current position
> > > }
>
> Just to stick my two cents in why bother with a ++
> operator in the for loop the increment is implied
>
> so you could write something like the following
> for (; r; )
> {
> *r;
> }
>
> increment and test makes more sense for a range object
> within the of a loop. Right :-)

I disagree.
Code should not be a short as possible, it should be as meaningful as
possible.
The intent is obvious with the idiom "for(; r; ++r)" and it should be.

Bernard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk