On Fri, Aug 09, 2002 at 10:37:10AM +0100, Angus Leeming wrote:

...

> > > Andre ? Martin ?
> >
> > Seems correct to me. The first dozen lines or so in LyXText::setCounter
> > are: if a par has no previous(), it resets its counter array, otherwise it
> > copies the one of its predecessor. Should cover all cases.
> >
> > Inside Counters::reset and copy, I don't see it either. What should be
> > undefined? match, if it is the empty string? To my eyes, it looks OK.
> > Or is perhaps .find() not supposed to have an empty arg?
> 
> It doesn't, it has a string argument that just happens to be empty. That's 
> fine and string::find will return string::npos (for which you already test).

Unfortunately it didn't work properly. That's why I added the separate
empty test. (It returned haphazard, random-looking boolean values for

it->first.find(match) != string::npos

in case match was empty. That's gcc-2.95.2 on intel-linux.)
 
> That is assuming that you haven't populated your map with an empty string() 
> as an index...

Have I? :-)
 
...

> And whether you choose to use two loops or one, that should be match.empty(), 
> not match == "". 

Be my guest.
 
> If you choose to remain with a single loop then you should also move the 
> match.empty() test to the front of the if statement as it's quicker than 
> find... (I believe that they're executed in order).

Yes, I agree.
 
> Angus
> 

Martin

Attachment: msg42284/pgp00000.pgp
Description: PGP signature

Reply via email to