"Fernando Cacciola" <[EMAIL PROTECTED]> writes:

> ----- Original Message -----
> From: "David Abrahams" <[EMAIL PROTECTED]>
> To: "Boost mailing list" <[EMAIL PROTECTED]>
> Sent: Tuesday, December 10, 2002 10:00 PM
> Subject: Re: [boost] Formal review: Optional library
>
>
>> "Fernando Cacciola" <[EMAIL PROTECTED]> writes:
>>
>>
>> > I still don't like to think of optional<> as a container, so I still
>> > don't like this reset.
>>
>> Do you really think of auto_ptr and shared_ptr as containers? They
>> seem to have little or nothing in common with any of the standard
>> containers.
>>
> OK.
> After further thinking I agree that optional<> is as much as a container
> as a smart pointer -not much really-, meaning that you pass a value which
> is contained within the wrapper and which you can access it.

Unfortunately, I also agree with Peter Dimov's analysis of the ways in
which optional<> /is/ like a container.  I just meant that the current
_interface_ to optional<>, auto_ptr<>, and shared_ptr<> has nothing in
common with a container's interface.  Sorry to make this difficult.

>> > I'm not sure what would be effect of removing deep-constantness.
>> > It would definitely allow the leaner interface you are proposing,
>>
>> Well, deep-constantness is utterly inconsistent with the pointer-like
>> semantics you claim to be implementing.  A pointer-ish optional
>> component is a fine idea, but why not follow through all the way with
>> the idiom?
>>
> How is deep-constantness utterly incosistent with pointer-like semantics?

    typedef T* ptr;
    T x;
    ptr const p = &x;
    T y = *p = x;  // constness of p does not affect mutability of referent

If you think deep constness is important, go with a container-like
interface.  Mixing idioms, especially very familiar ones, is
confusing.

>> > This is a possibility.
>> > I could accept something like this, though I constantly see
>> > people complaining about lack of deep constantness on wrappers like
>> > optional<>
>> > What do others think?
>>
>> Is it a wrapper or a pointer?
>>
> Is a wrapper which acts partially like a pointer.

What I said before about mixing idioms, again.

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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to