Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2005-02-15 13:16:26

"Fernando Cacciola" <fernando_cacciola_at_[hidden]> escribió en el mensaje
> "Joe Gottman" <jgottman_at_[hidden]> escribió en el mensaje
> news:curjg1$2vq$
>> [SNIP]
>> It has the added advantage that if T's assignment operator has the strong
>> exception safety guarantee, so does optional<T>'s assignment operator.
> Well, this is a good point.
> It is typical for classes with a throwing copy ctor to have a strong
> assignment.
OK, I was sure there was a good reason why I didn't use T's assignment to
begin with.
I just didn't remeber it when I responded.
The idea is that by using T's operator=() we are _entirely_ left to its own
exception guarantees, with no guarantee at all from optional<T> itself.
The current implementation gives you the basic guarantee, which is more than
enough in most cases, no matter how ill T could be: if something goes wrong
while reseting the value of *this, it is left uninitialized.

So the correct path is to add the cannonical guard AFAICS.


Fernando Cacciola

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