Boost logo

Boost :

Subject: Re: [boost] [gsoc-2013] Boost.Expected
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-05-01 17:33:22


Le 01/05/13 18:27, TONGARI a écrit :
> I didn't follow this thread closely, but have you consider an implicit
> convert operator to value_type? e.g.
>
> expected<SomeType> f();
>
> SomeType var = f(); // throws on error
>
> It's most intuitive to me.
>
>

We need to choose between an explicit conversion to bool and an implicit
(or explict) conversion to value_type, otherwise there would be a
conflict when the value_type is bool. I prefer particularly the explicit
bool conversion. This is in line with the optional design.
BTW, the following is not so ugly.

     SomeType var = f().value(); // throws on error

Best,
Vicente


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