On 01/16/18 19:25, Andrzej Krzemienski via Boost wrote:
2018-01-16 17:15 GMT+01:00 Andrey Semashev via Boost
: 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.