Boost logo

Boost :

Subject: Re: [boost] [outcome] comments on Regular ops
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2018-01-22 23:35:02


2018-01-22 23:31 GMT+01:00 Gavin Lambert via Boost <boost_at_[hidden]>:

> On 23/01/2018 03:53, Niall Douglas wrote:
>
>> My recommendation would be not to provide comparison operators if either
>>> `T` or `EC` does not provide them.
>>>
>>
>> Agreed. Logged to https://github.com/ned14/outcome/issues/107
>>
>
> I assume this would be individually for each case?
>
> There is still benefit in providing operator==(EC) even if T does not
> provide operator==, eg. for the construct:
>
> if (outcome == make_error_code(xxx))
>
> (not sure if this is the exact spelling, but it's something like this)
>
> Especially in generic code templated on T. The alternative is much more
> wordy and not really any clearer.
>

This could be handled by providing a dedicated heterogeneous comparison
between `result<T, EC>` and `EC`. But my preference would be a dedicated
function.

Regards,
&rzej;


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