On Mon, Jul 21, 2003 at 06:19:12PM +0200, Lars Gullik Bjønnes spake thusly: > > Angus Leeming <[EMAIL PROTECTED]> writes: > > | This is going to bomb unless you add a return statement > | +void BranchList::setColor(string const & s, string const & val) > | +{ > | + List::iterator it = list.begin(); > | + List::iterator end = list.end(); > | + for (; it != end; it++) { > > Use ++it, instead of it++.
OK... done. ... > | + string name; > > only used in loop? Yes. > | + string::size_type i = 0; > > this too? eh... > | + Branch br; > > this too? Yes. > | + for (;;) { > > A bit too C-like to me. I prefere while (true), matter of taste I > guess. I had a while there earlier... a wrong one tho :-) > | + string::size_type const j = s.find_first_of(separator(), i); > | + name = s.substr(i, j - i); > | + br.setBranch(name); > | + br.setSelected(false); > | + br.setColor("none"); > | + list.push_back(br); > | + if (j == string::npos) > | + break; > | + i = j; > | + i++; > > ditto > but why not "i = j + 1"? Yes why not. ... > Why isn't i part of the loop setup? > (ah.. i = j) > What about it? That's why. Is there a niftier/clearer way? ... > -- > Lgb > Martin PS Attached my latest brainchild. This one received some more thorough exercising. Should be no serious bugs left (famous last words :-) Someone not me should try this out. -- Martin Vermeer [EMAIL PROTECTED] Helsinki University of Technology Dept. of Surveying, Inst. of Geodesy P.O. Box 1200, FIN-02015 HUT, Finland :wq
branch_e.diff.gz
Description: application/gunzip
pgp00000.pgp
Description: PGP signature