
24 Oct
2005
24 Oct
'05
6:22 p.m.
"Fernando Cacciola" <fernando_cacciola@hotmail.com> 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