Subject: Re: [boost] Improving the assignment operators of various Boosttypes
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2008-09-11 13:58:51
David Abrahams wrote:
> on Thu Sep 11 2008, Gevorg Voskanyan wrote:
> > AFAIU, a swapping assignment operator taking the parameter by const ref
> > to the strong exception safety guarantee, whereas the one taking the parameter
> > by value fulfills the nothrow guarantee. Not sure how practical and/or
> > the difference in this context is, though.
> > Is my observation above correct?
> Well, technically, yeah... although the expression that does the
> assignment can still throw, so I don't think it makes much difference to
> say that it's nothrow. In other words, if I give you
> f(std::string); // nothrow
> g(std::string&); // strong guarantee
> For all practical purposes, you know that f and g have equivalent
> exception behavior because std::string's copy ctor can throw.
True, that's why I questioned the practicality of this difference :)
Except perhaps for documenting a function's exception safety. Should it be considered while making aforementioned assignment operators in boost to take the argument by value?
> I think this calculus might get more interesting when rvalue references
> are involved, because you can actually write stronger conditional
My early impression is that rvalue references are going to make life much more interesting :-)
Thanks for your time, Dave!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk