Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-10-23 20:56:32

Dave Abrahams:

> Sure, it's not always the best approach. It's still the safer
> approach, and I prefer the safer approach to be more convenient.

you keep referring to the copy variant as "safer" even though the safety
differs from person to person.
what is really the difference between the two approaches?
Assume trim() copies:

trim( s ); // now I expect s to be modified, but it's not, so I have a "hard
to catch bug"

Assume is mutates:

trim( s ); // now you have a "hard to catch bug"

so what is safer for you is not safer for me. What it boils down to is that
there has to be other arguments for the chosen approach; I believe I gave 6
reasons for
trim to mutate and none for copying.



Boost list run by bdawes at, gregod at, cpdaniel at, john at