
David Abrahams skrev:
On Mar 6, 2009, at 2:30 AM, Thorsten Ottosen wrote:
For the operations that they have in common, it is almost a drop-in replacement. I say almost, because this class is really about speed, and often don't allow overlapping ranges, assignment to *this etc. The exception-safety guarantees might also be weaker if it hurts performance.
I think anything that's an "almost" needs an explicit rationale. I really don't, for example, see why the self-assignment check is worth omitting.
The rationale would be simplicity, speed and less generated code.
Remark: the comment is more general, and also pertains to non-e.g. not allowing overlapping ranges.
Have you measured the speed/space difference and found it to be significant in any real application?
A class that attempts to provide value semantics but doesn't support x = x is putting a big hole in the system of equational reasoning. Justifying that (to me) would take some pretty heavy proof.
I have not really seen code that exhibits x = x. I've seen lot's of discussion (e.g. Sutter & Meyers). Does anybody write such code? -Thorsten