Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-12-11 09:19:02


----- Original Message -----
From: "David Abrahams" <dave_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Tuesday, December 10, 2002 10:00 PM
Subject: Re: [boost] Formal review: Optional library

> "Fernando Cacciola" <fernando_cacciola_at_[hidden]> 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.

> > My motivation against this is just to prevent potential problems with
> > optional<bool>, but if we collectively conclude that those problems
> > are not so much important, I will add the safe_bool and
> > make sure to tell every not to use optional<bool> (and use tribool
instead)
> > or else to use it with caution.
>
> I don't think any special warnings are needed; the problem case you
> cite seems contrived to me.
>
Perhaps.
Anyway, if I add safe_bool (and it looks like I will) I will explain
the potential problems in the docs just in case.

> > 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?

> > 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.

Fernando Cacciola


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