Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2005-10-12 04:20:40

"Fernando Cacciola" <fernando_cacciola_at_[hidden]> writes:

> Specifically... wouldn't you find odd that the result of assignment depends
> on whether the lvalue was previously absent or not? Don't you agree that
> _most_ people would call _that_ counterintuitive?

That's what optional now does for non-reference types! If you're going to use
assignment for the underlying type in optional<X>, then a special case for
references that rebinds the reference seems wrong. OTOH, if you think that
rebinding the reference is the right thing to do, then it is inconsistent to
use assignment for non-reference types; these should be "rebound", too --- the
old object destroyed, and a new one created.

Special cases are awkward.


Anthony Williams
Software Developer
Just Software Solutions Ltd

Boost list run by bdawes at, gregod at, cpdaniel at, john at