Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-12-10 20:00:24


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

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

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

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

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