ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
RE: [boost] Re: Mini-review request: aligned_storage.hpp
by Anthony Williams other posts by this author
Aug 9 2002 7:50AM messages near this date
[boost] Re: Boost Digest, Vol 92, Issue 3 | RE: [boost] Re: Re: Threads & Exceptions
From: Eric Friedman [mailto:ebf@[...].net]
Sent: 08 August 2002 11:00
>  >From David Abrahams:
>  
>  > From  "Eric Friedman" <ebf@[...].net>
>  [snip]
>  > >  * Is it a major obstacle that Boost.Variant will not offer 
>  > > exception-safe assign
>  > >    or swap unless externally wrapped with the pimpl idiom? Should 
>  > > boost::fast_variant
>  > >    and boost::safe_variant be introduced to encapsulate yet allow 
>  > > choice in this issue?
>  > 
>  > Wait!
>  > 
>  > ***** There's nothing unsafe about the basic guarantee. *****
>  > 
>  > The strong guarantee is not the holy grail of exception-safety, as
>  many
>  > people seem to think. It's just a useful behavior to distinguish.
>  > There's no reason to resort to heroics just to achieve it.
>  
>  Well, having the strong guarantee does make variant's use much, much
>  nicer.
>  
>  Now, in the process of removing the undefined behavior from swap and
>  assign, I've had to reintroduce the notion of an empty 
>  variant (namely,
>  an empty variant is one that has only "partly" made it 
>  through an assign
>  or a swap).

I've just had a thought about how to implement the strong guarantee for
variant, at the expense of larger space requirements --- have *two* copies
of the internals, with a flag to indicate which is valid. Then, when
swapping or assigning, copy construct the value from the other variant into
the unused space, and destruct the original and switch the flag when
everything is done.

What do people think?

Anthony
Attachments:
unknown1


Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved