
on Thu Sep 11 2008, Joel Falcou <joel.falcou-AT-u-psud.fr> wrote:
David Abrahams a écrit :
Swapping and taking the parameter by value are orthogonal issues; the latter has only to do with copy elision and not with exception safety. Please see this thread:
Very interesting article. So my question is - as a teacher - what techniques should I teach to my student and with which justification ?
self& operator=(self x) { swap(*this,x); return *this; } with the rationale given in http://groups.google.com/group/comp.lang.c++.moderated/msg/5e6014446d559b63 (I suspect Andrei's CUJ article is equally good or better but much longer) ...but I would think given the thread mentioned above that answer would be self-evident, so it makes me wonder if you're trying to ask something else. -- Dave Abrahams BoostPro Computing http://www.boostpro.com