Boost logo

Boost :

Subject: Re: [boost] [review] Review of Outcome (starts Fri-19-May)
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-21 22:23:46

Niall Douglas wrote:

> Unless I have misunderstood your patch, you bring in error_condition
> comparisons from <system_error> allowing one to compare error codes to
> error conditions across both Boost and STL error categories.
> This is fine, and indeed valuable. But it isn't relevant to Outcome
> particularly because we cannot say what the end user is doing with their
> error_code, and certainly not if whatever they are doing has any relation
> to error_condition.

What the patch does is make boost::system::error_code and
boost::system::error_condition convertible to std::error_code and

The idea is that a function that returns std::error_code can use a function
that returns boost::system::error_code in its implementation and can then
return it directly.

In cases where the original boost::error_code can be compared to
boost::errc::foo, the converted std::error_code can be compared to the
equivalent std::errc::foo. In addition, if the original boost::error_code
can be compared to a custom boost::error_condition, the converted one can be
compared to the converted std::error_condition.

Long story short, the relevance to Outcome is that you can always store
std::error_code in result/outcome, even if the user passes you a
boost::error_code (because it will convert). There is no need to choose at
compile time which of the two to store, because you can take both. That is,
the function

    result<T> make_error_result( std::error_code const & ec );

will now be able to take Boost error codes as well.

Boost list run by bdawes at, gregod at, cpdaniel at, john at