Boost logo

Boost :

From: Sam Partington (sam.partington_at_[hidden])
Date: 2005-10-25 04:35:23


> I suggested to add:
>
> make_optional(v);
>
> as a shortcut for:
>
> optional<some_type>(v).
>
> People argued, with reason, that you still need to discriminate yourself
> references from non-references
> (so you would need to use a different shortcut, like, make_optional_ref(r))

How about :

o = make_optional(boost::ref(t));

But actually I'd rather say it explicitly all the time with

 optional<T>(t)

> So my current proposal would be:
>
> Remove direct-assignment.
> Let copy-assigment be the only way to define the wrapped value
> Add make_optional() and make_optional_ref() as shorcuts to help with
> copy-assignment
> Keep none-assignment as the only wat to clear the wrapped value.

That gets my vote. I'm not especially bothered whether make_optional
and make_optional_ref go in or not, the user can decided whether they
want to use it or not.

Sam


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