|
Boost : |
From: Matt Hurd (matt.hurd_at_[hidden])
Date: 2005-02-15 21:45:31
>On Tue, 15 Feb 2005 20:35:30 -0500, Joe Gottman
<jgottman_at_[hidden]> 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_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk