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 Fernando Cacciola other posts by this author
Aug 7 2002 9:02PM messages near this date
[boost] Re: Re: Mini-review request: aligned_storage.hpp | Re: [boost] Mini-review request: aligned_storage.hpp
----- Original Message -----
From: "Eric Friedman" <ebf@[...].net> 
To: "'David Abrahams'" <dave@[...].com> ; <boost@[...].org>
Sent: Wednesday, August 07, 2002 5:15 PM
Subject: RE: [boost] Re: Mini-review request: aligned_storage.hpp


>  [snipped]
>  Three questions come to my mind:
> 
>   * Are there any implementations that do not behave as desired under
>  this undefined
>     behavior? (Or more fundamentally, what is the reason for the
>  standard's behavior
>     on this issue?)
> 
Unless utterly neccesary, we must not make any assumptions about
implementations behaviour.

>   * 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?
> 
Personally, I would be more than happy with a variant which is not any more
exception-safe than the objects it wraps.


>   * Any ideas out there as to how to make variant::operator= and
>  variant::swap "as safe
>     as possible," yet still efficient, even if we can't guarantee strong
>  exception-safety?
> 
My personal preference in this area is to do nothing...

Consider:

T a(val0) ;
T b(val1) ;

b = a ;
// if assignment above throws, how much inconsistent is 'b' left is totally
undefined.

Therefore, with:

variant<int,T>  va (a);
variant<int,T>  vb(b);
va = vb ;

Struggling to make the above assignment exception safe is too dificult -if
at all possible-,
while doing nothing at all won't ever be worse than the case of using T
directly.


In any event, if I need to put such touchy objects in a variant, I can
always wrap the object, with a exception-safe but specific assignment
mechanism, and put the proxy in the variant instead.


Fernando Cacciola
Sierra s.r.l.
fcacciola@[...].com
www.gosierra.com



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Fernando Cacciola
Eric Friedman
Fernando Cacciola
Douglas Gregor
Fernando Cacciola
Douglas Gregor
Itay Maman
David Abrahams
Eric Friedman
Itay Maman
Fernando Cacciola
David Abrahams
Eric Friedman
Douglas Gregor

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