Boost logo

Boost :

Subject: Re: [boost] [optional] Safe optional
From: Sylvester-Bradley, Gareth (Gareth.Sylvester-Bradley_at_[hidden])
Date: 2014-11-20 11:29:00


On Nov 20, 2014 at 16:13, Bjorn Reese wrote:
> On 11/20/2014 11:49 AM, Andrzej Krzemienski wrote:
> > The user-provided int can be any value of int plus the situation where user
> > decides not to type any input. the latter is a valid and useful
> > information. E.g. when an int represents some threshold, having boost::none
> > means "go with no threshold". boost::none is just a value. this in turn
> > implies the implicit conversions:
> >
> > optional<int>() != 2;
> >
> > The above is logical and useful, even outside of the containers.
>
> As optional is a nullable type, it could be useful to let the comparison
> operators return a tri-bool instead of a bool.

There are a number of well-trodden paths for these kind of comparisons...
optional(none) could be 'bottom' as it is now,
or follow the example of IEEE floating point NaN,
or follow three value logic like NULL in SQL.
I think those are all differently sensible, and there are probably more...

Best regards,
Gareth

************************************************************************ The information contained in this message or any of its attachments may be confidential and is intended for the exclusive use of the addressee(s). Any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited without the express permission of the sender. The views expressed in this email are those of the individual and not necessarily those of Sony or Sony affiliated companies. Sony email is for business use only. This email and any response may be monitored by Sony to be in compliance with Sony's global policies and standards


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