Boost logo

Boost :

Subject: Re: [boost] Improving the assignment operators of various Boosttypes
From: Joe Gottman (jgottman_at_[hidden])
Date: 2008-09-10 21:23:17

Joel Falcou wrote:
> I may come late and maybe like an unwanted guest in this discussion but
> I am curious to know how i can know that for a given class of mine, the
> swap value operator= is better than the by const ref operator= ?

    My rule of thumb is that if your assignment operator might throw an
exception and you want assignment to fulfill the strong exception safety
guarantee (i.e. either the assignment succeeds or the target remains
unchanged) then you should consider the swapping operator=.

Joe Gottman

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