
On Tue, 15 Feb 2005 20:35:30 -0500, Joe Gottman <jgottman@carolina.rr.com> wrote: I disagree. This may ensure the basic exception-safety guarantee, but most code that uses optional<T> will use T::operator=() at some point or other. So if T::operator=() is not exception-safe, chances are good any program that uses optional<T> will not be exception safe either, regardless of whether optional<T> is. Thus, you are not gaining too much. And you are losing the strong exception safety guarantee when T::operator=() has it. I think you are much better off implementing optional<T>'s assignment from T's rather than using the destroy and recreate idiom.
Interesting debate. Performance / safety tradeoffs. You shouldn't pay for what you don't use issues. I wonder if anyone can point me to priors on a PBD approach to exception safety: e.g. boost::optional<thing, nutz::strong_guarantee > matt. matthurd@acm.org