2007/7/17, Jon Keating <[EMAIL PROTECTED]>:
The point is to force a copy. One of the users, Crazy_Hopper on IRC was
reporting a crash and it was fixed by not using a reference as the parameter.
Something may be strange with his STL version. I'll try and confirm with him
about that.

If it crashes when using a reference, something must serious wrong
with his compiler. After all, the string is copied (again) when it is
added to the map.

Perhaps you should add that to the coding style?
if (pending.length()) = If has some length
if (pending.size()) = If has some size
if (!pending.empty()) = If not empty

All seem the same to me...

It's all about intent, and I guessed that you wanted to check if the
string was non-empty, not that the length was non-zero. It's a tiny
tiny difference, but I'm a bit pedantic from time to time... (If you
disagree I hope that you ignore me or scream at me loudly :))

If nothing else, empty() may actually (in some strange, badly
implemented, probably non-existing) implementations be faster than
length(). Think not storing the length, only a char pointer...

// Erik

--
Erik Johansson
http://ejohansson.se/

Reply via email to