Boost logo

Boost :

From: Rainer Deyke (rainerd_at_[hidden])
Date: 2003-10-09 14:50:36


Brock Peabody wrote:
> (5) If variant can be singular you will need an additional case for
> each variant and possibly turn many compile-time errors into run-time
> errors.
> This is a fact too.

While trivially true, I doubt this is actually important in real code. If a
variant operation that only provides the basic guarantee throws, the state
of the variant is "valid" but undefined. This means that the variant
contains no useful data, and the invariants of the piece of code which uses
the variant may (temporarily) be broken. The only meaningful responses to
the exception are therefore to replace the value in the variant with another
(potentially resulting in another exception) or to destroy the variant
(explicitly or implictly).

-- 
Rainer Deyke - rainerd_at_[hidden] - http://eldwood.com

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