From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2005-10-11 12:20:55
> I have some code that has been merrily using the 1.32.0 release of
> boost, including boost::optional, and I've just tried to change to
> use the 1.33.0 release (this is the first change to this codebase
> since 1.33.0 was released).
> In my code, I have boost::optional<X> where X is copy-constructible,
> but not assignable. This works in 1.32.0, but fails in 1.33.0. Ouch!
> What is the reason for the change?
I need to dig up the archives to recall the exact reason... I do remeber
though that there was a good one.
As for the _justification_ for a breaking change, the idea was that if X is
then optional<X> should not be assignable either, or at the very least, you
don't need it to be assignable.
That is, you can always write:
optional<X> o ;
o = none ;
o = v;
instead of just
o = v ;
if X is non-assignable.
Anyway, don't you agree that optional<X>::operator= should go through
X::operator=? And in that case, is there a choice but to have optional
assignment fail with non-assignable types?
> Why is this not listed in the
> "Updated libraries" section of the docs?
Becuase I failed to list it there.
> Why is this not listed under
> the "Type Requirements" section of the docs?
Because I forgot to add it.
The specific docs for operator= do mention that T's operator = is used; but
you're right I forgot to update the requirements.
Anyway, does the "reset it first" trick work for you? Do you think this
change has to be rolled back (just asking)?
-- Fernando Cacciola SciSoft http://fcacciola.50webs.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk