• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>Conclusion - 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/interop/app-go.html"><img src="../../../images/prev.png" alt="Prev"></a>
11    <a accesskey="u" href="../../../tutorial/advanced/interop.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="../../../recipes.html"><img src="../../../images/next.png" alt="Next"></a></div><div id="content">
13  <div class="titlepage"><div><div><h1 style="clear: both">Conclusion</h1></div></div></div>
14  <p>This worked example was in fact excessively complex: a quicker route
15to achieving the same thing would be to add explicit converting constructors
16to <code>app::error_code</code> for each of the third party library <code>E</code> types.
17One then could have saved oneself with having to bother injecting
18custom converters into the <code>BOOST_OUTCOME_V2_NAMESPACE::convert</code> namespace.
19If you control your application&rsquo;s <code>E</code> type, then that is probably a
20better, and certainly simpler, approach.</p>
21
22<p>However there are occasions when you don&rsquo;t have control over the
23implementation of the destination <code>E</code> type e.g. in callbacks. Outcome&rsquo;s <code>ValueOrError</code>
24infrastructure lets you inject custom interop code for any pair
25of incommensurate third party <code>E</code> types, without needing to modify either&rsquo;s
26source code.</p>
27
28<p>This is without doubt a &ldquo;power users&rdquo; feature, but
29one which will prove useful as <code>T|E</code> based C++ code proliferates.</p>
30
31
32        </div><p><small>Last revised: February 11, 2019 at 13:38:04 UTC</small></p>
33<hr>
34<div class="spirit-nav">
35<a accesskey="p" href="../../../tutorial/advanced/interop/app-go.html"><img src="../../../images/prev.png" alt="Prev"></a>
36    <a accesskey="u" href="../../../tutorial/advanced/interop.html"><img src="../../../images/up.png" alt="Up"></a>
37    <a accesskey="h" href="../../../index.html"><img src="../../../images/home.png" alt="Home"></a><a accesskey="n" href="../../../recipes.html"><img src="../../../images/next.png" alt="Next"></a></div></body>
38</html>
39