Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-10-24 13:22:29


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

> Rob Stewart wrote:
>>
>> Yes, an interface for non-assignable types that doesn't requiring
>> parameterizing optional would be good. IOW, o.rebind(rb) rather
>> than o = optional<T&>(rb).
>>
> Right.
>
> make_optional(v) doesn't work because it can't tell whether we want a T or a
> T&
>
> optional_tie() would work but it requires the user to know wheter T or T& is
> needed.
>
> direct assignment is troublesome.
>
> So the only choices I see are:
>
> o.rebind(rb)
>
> or
>
> o = optional<T&>(rb).
>
> And I think I like the rebind() better.

I like the latter. The name "rebind" doesn't make much sense for
optional<T> where T is not a reference.

-- 
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