Boost logo

Boost :

Subject: Re: [boost] Reforming Boost.System and <system_error> round 2
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2018-01-16 16:35:37


On 01/16/18 19:25, Andrzej Krzemienski via Boost wrote:
> 2018-01-16 17:15 GMT+01:00 Andrey Semashev via Boost <boost_at_[hidden]>
> :
>
>> On 01/16/18 19:10, Andrzej Krzemienski via Boost wrote:
>>>
>>> This is now getting closer to Boost.outcome, isn't it?
>>
>> With my limited knowledge of Boost.Outcome, I don't think so. An outcome
>> is supposed to carry a value or error, and `error_code` carries only the
>> error code.
>
> Boost.Outcome provides a number of tools. One of types, `result<void>`
> (maybe error of value, but value is void), is exactly this: a `bool` flag
> and an `error_code`.

Still, it is a different thing, semantically. If the `bool` is `true`
(i.e. indicates value), it contains no error code, doesn't it? At least,
I don't think it should.

Also, a small technical detail. I believe carefully adding the flag to
`error_code` doesn't increase its size. On 64-bit systems it fits nicely
in the padding area. On 32-bit systems it could be merged into the
category pointer, if we really wanted. Not sure `result<void>` does that.


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