Boost logo

Boost :

Subject: Re: [boost] expected<T, E...> (Was: [outcome] High level summary of review feedback accepted so far)
From: Peter Dimov (lists_at_[hidden])
Date: 2017-06-04 20:40:51


Gottlob Frege wrote:
> On Sun, Jun 4, 2017 at 12:35 PM, Peter Dimov via Boost
> > Perhaps the heuristic could be, if the argument can be interpreted as
> > both a value and an error, the conversion is ambiguous, regardless of
> > which of the two is a better match. This will make the above return
> > ambiguous, which is probably as it should be.
>
>
> I think I might agree with that.
> There will definitely be cases where expected<T,E> has T == int and E ==
> int, and worse, sometimes those cases will be:
> - T is a template param, so you don't "see" that it is sometimes an int
> - E is a #define or platform-defined, etc, so it is only _sometimes_ an
> int

T == int, E == int is not a problem, because it will always be ambiguous.
The thorny case is E == int, T == something convertible from int, such as
double, long, unsigned.


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