|
Boost : |
From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2003-08-31 12:22:43
Daniel Frey wrote:
> Fernando Cacciola wrote:
>> My main argument is that if those were allowed, you could write:
>>
>> optional<int> opt ;
>> opt = 1 ;
>> int i = *opt ;
>>
>> and the assymetry didn't look right to me.
>
> I agree that this looks wrong. What about this syntax:
>
> optional<int> opt;
> *opt = 3;
> int i = *opt;
> opt->foo();
>
This was exactly the way the originally submmited optional<> worked.
I dropped it becasue reviweres thought that (*opt)=3 would lead to
undefined behaviour just as if *opt were an rvalue.
I realized that with true pointers, for instance, (*opt)=3 is in fact
undefined behaviour, so I replace it with .reset()
Fernando Cacciola
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk