Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-12-11 15:55:47


"Peter Dimov" <pdimov_at_[hidden]> writes:

> From: "Fernando Cacciola" <fernando_cacciola_at_[hidden]>
> [...]
>> (1) deep-constantness:
>>
>> I Followed David Abraham's suggestion and decoupled
>> constantness of the optional<> object with that of
>> the value being wrapped.
>> This is how pointers and most smart pointers work, so
>> the pointer semantic should suffice to explain this behaviour.
>
> Hm. Did Dave really suggest that? :-)

Not exactly. I said that deep constness is inconsistent with a
pointer-oriented interface.

> To reiterate, my opinion is that deep constness is much more
> appropriate for optional<>. Constness and copying go hand in hand:
> deep copy corresponds to deep constness, and shallow copy
> corresponds to shallow constness. Optional<> does a deep copy. Even
> smart pointers that do deep copy use deep const.

Oh, well yeah. There are some smart pointers that do that. I've
never touched one. So maybe a "deep" optional with a smart pointer
interface is not such an odd beast.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk