Re: assignment operator implementation
"Andrei Alexandrescu (See Website For Email)"
<SeeWebsiteForEmail@erdani.org> writes:
David Abrahams wrote:
"Andrei Alexandrescu (See Website For Email)"
<SeeWebsiteForEmail@erdani.org> writes:
Exception safety has a price, no doubt about it.
No, it doesn't! The C++ standard library exception-safety
specification imposes no overhead in principle over the earlier
version that specified undefined behavior if user-supplied operations
threw.
I meant something different but was hasty:
Okay; if you understand it already, please be more careful to say what
you mean. People have way too many misconceptions about this without
help from the influential-but-hasty.
1. If you aim for "higher" exception safety you incur more costs;
that's a spec issue.
2. If you implement an assignment with copy-and-swap you might incur
additional overhead compared to a hand-made correct implementation;
that's an implementation issue.
Unless you've specified less overhead, in which case it's a spec issue
too :)
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]