Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Prev Up HomeNext

Conclusion

This worked example was in fact excessively complex: a quicker route to achieving the same thing would be to add explicit converting constructors to app::error_code for each of the third party library E types. One then could have saved oneself with having to bother injecting custom converters into the BOOST_OUTCOME_V2_NAMESPACE::convert namespace.

However there are occasions when you don’t have control over the implementation of the destination E type e.g. in callbacks. Outcome’s ValueOrError infrastructure lets you inject custom interop code for any pair of incommensurate third party E types, without needing to modify either’s source code. This is without doubt a “power users” feature, but one which will prove useful as T|E based C++ code proliferates.

Last revised: November 16, 2017 at 21:31:08 UTC


Prev Up HomeNext