From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2005-10-24 12:17:14
Hamish Mackenzie wrote:
> On Tue, 2005-10-18 at 15:03 -0300, Fernando Cacciola wrote:
>>> I still can't think of an
>>> example where it is desirable to have X * and optional< Y > use the
>>> same interface.
>> Dave's just gave one.
> Indeed and I am convinced. Please read my response to that message
> though as I had some other questions.
>> Something like that is already supported (opt != none)
>> It's just not the only way to test for absence.
>> In any event, if dropping safe_bool() were a good idea (I'm unsure
>> the bool case worth dropping it), that could be left as the only
> (opt != none) is cool. Does it work for other OptionalPointees too?
> not, could it?
The std optional<> proposal uses "nullptr" which is the typed null pointer
constant also proposed for standarization.
( o != nullptr ) would then work with pointers (raw and smart) and
optional<> (it would be part of the Nullable concept)
> If the the others stay, the documentation should at least be revised
> indicate that the problem is not limited to optional< bool >. Even
> changing from "std::istream &" to "optional< std::istream > &" could
> easily lead to confusion (boost::tribool won't help much there).
> For the record I would be against including (opt != 0) for the same
> reason I don't like the "safe_bool" and "operator !". In fact I don't
> much care for them existing for any pointers.
Indeed. Getting rid of the '0' is the motivation behind nullptr.
> Thank you for taking the time to address my concerns.
Thank you for taking the time to post your concerns!
-- Fernando Cacciola SciSoft http://fcacciola.50webs.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk