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,

Dave Abrahams
Boost Consulting

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