Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-10-18 11:47:23


Anthony Williams <anthony_w.geo_at_[hidden]> writes:

> How's this for a radical thought --- optional<T> should not be assignable from
> T. That way, it doesn't matter whether T is a reference, or not.

There's at least some precedent for types that are "immutable except
for copy assignment."

The assignment from T is really a kind of mutating operation.

> Instead, to change the binding, use reset(), and to assign use *.

To make that valid for a null optional, I think operator* would have
to return a proxy reference... which is not an altogether bad idea,
IMO.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk