|
Boost : |
From: Hamish Mackenzie (hamish_at_[hidden])
Date: 2005-10-18 19:33:56
On Tue, 2005-10-18 at 14:52 -0300, Fernando Cacciola wrote:
> // (1) Current case:
> o = rb ; // rebind or not??
>
> // (2) Antonty's proposal:
> o.reset(rb); // still some room for doubts?
>
> // (3) Sam's proposal:
> o = make_optional(rb); // Clearly rebinds, doesn't it?
>
> // I just introduced make_optional() here to get rid of the template
> argument
>
I am kind of diving in here having not read much of the option< T & >
stuff in this thread, but how about..
o = make_optional( &rb );
To balance the indirection of *o and o->
Also, could be compatible with pointers
int * p = make_optional( &rb );
o = make_optional( p );
p = make_optional( o );
See my earlier post for an example (I used "opt" instead of
"make_optional").
Hamish
PS. I know, I was the one arguing against pointer interfaces a few hours
ago and now I want more :-) (but not safe_bool, "!o" or "o != 0")
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk