1 May
2013
1 May
'13
9:33 p.m.
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