Boost logo

Boost :

From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-10-08 23:11:54


--- brock <brock.peabody_at_[hidden]> wrote:
[...]

> No resources are leaked and class invariants are maintainted.
>
> > Let's say that there is an assignment exception
> > and varaint<t1,t2> has one of
> > the value-initialized types, t1 or t2 now.
> > What do you normally do with that?
>
> I don't know what you would want to do, but my understanding is that if an
> exception has been thrown from an operation on an object, and that operation
> does not make the basic guarantee, the results of subsequent operations on
> that object are undefined - it might not even be safe to destroy it.

I understand all these theoretical considerations.
What would you normally do in practice?
Are there any useful practical techniques
that would clearly benefit from basic guarantees?

Remember that after the exception the
original object could be already gone.
The variant has just a value initilized object now.
Who cares whether this value initialized
object has a type from variant types
or of some internal type.
The rest of the code will have to be able
to handle it anyway. This is why boost::variant
has the 'backup' flag. In practice,
it is no different from singular variant.

Eugene

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk