1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 3<title>Interoperation - Boost.Outcome documentation</title> 4<link rel="stylesheet" href="../../css/boost.css" type="text/css"> 5<meta name="generator" content="Hugo 0.52 with Boostdoc theme"> 6<meta name="viewport" content="width=device-width,initial-scale=1.0"/> 7 8<link rel="icon" href="../../images/favicon.ico" type="image/ico"/> 9<body><div class="spirit-nav"> 10<a accesskey="p" href="../../tutorial/advanced/hooks/hook_outcome.html"><img src="../../images/prev.png" alt="Prev"></a> 11 <a accesskey="u" href="../../tutorial/advanced.html"><img src="../../images/up.png" alt="Up"></a> 12 <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../tutorial/advanced/interop/problem.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content"> 13 14 <div class="titlepage"><div><div><h1 style="clear: both">Interoperation</h1></div></div></div> 15<p>This is the final section of the tutorial, and it is unavoidably quite lengthy 16as we are going to tie together all of the material covered in the tutorial 17so far into a single, unified, application of Outcome’s facilities.</p> 18 19<p>One thing which Outcome solves – and which alternatives do not – is how to 20<strong>non-intrusively</strong> tie together multiple third party libraries, each using 21Outcome – or some other <code>T|E</code> implementatation like 22<a href="https://wg21.link/P0323" class="api-reference" target="_blank"><i class="fa fa-book" aria-hidden="true"></i> P0323 <code>std::expected<T, E></code></a> 23 24– with custom incommensurate <code>E</code> types, or indeed arbitrary return 25types which are “split” <code>T|E</code> return types. Solving 26this well is the <em>coup de grâce</em> of Outcome against alternative approaches 27to this problem domain, 28including <code>std::expected<T, E></code>. It is the major reason why you should 29consider using Outcome over alternatives, including Expected.</p> 30 31<p>Firstly we shall explore some of the problems faced by the software 32developer when <code>T|E</code> return type based code proliferates at scale, 33where dozens of libraries may be using completely incompatible <code>T|E</code> return types.</p> 34 35<p>Secondly we shall introduce the <code>ValueOrError</code> concept support in Outcome, 36which implements a subset of the proposed <a href="https://wg21.link/P0786">WG21 <code>ValueOrError</code> 37concept framework</a>.</p> 38 39<p>Finally, we shall then step through a worked example which mocks up a realistic 40situation that the software developer may find themselves in: tying 41together disparate third party libraries, whose source code cannot be 42modified, into an application-wide, mixed-mode <code>T|E</code> and exception 43throwing universal error handling system which is capable of 44accurately representing the original failure, but also propagating it 45in a way that the application can deal with universally.</p> 46 47 48 49 </div><p><small>Last revised: February 08, 2019 at 22:18:08 UTC</small></p> 50<hr> 51<div class="spirit-nav"> 52<a accesskey="p" href="../../tutorial/advanced/hooks/hook_outcome.html"><img src="../../images/prev.png" alt="Prev"></a> 53 <a accesskey="u" href="../../tutorial/advanced.html"><img src="../../images/up.png" alt="Up"></a> 54 <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../tutorial/advanced/interop/problem.html"><img src="../../images/next.png" alt="Next"></a></div></body> 55</html> 56