
"Fernando Cacciola" <fernando_cacciola@hotmail.com> writes:
// (2) Anthony's proposal: o.reset(rb); // still some room for doubts?
How about o.replace_with(rb); does that suggest rebinding? I was imagining that reset (or replace_with) would always rebind/replace the contained element, rather than assign to it. Then it would also work with my non-assignable types.
// (3) Sam's proposal: o = make_optional(rb); // Clearly rebinds, doesn't it?
I could run with this. As for Mat's concerns about using optionals in place of normal values: * if the conversion constructor is not explicit, then that allows constructing an optional<T> from a T * we could provide a means of capturing a value into an optional: std::pair<Foo, Bar> do_stuff(); boost::optional<Foo> foo; boost::optional<Bar> bar; tie(rebinder(foo),rebinder(bar))=do_stuff(); Anthony -- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk