• 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>Experimental - 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="./recipes/foreign-try.html"><img src="./images/prev.png" alt="Prev"></a>
11    <a accesskey="u" href="./index.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="./experimental/advantages.html"><img src="./images/next.png" alt="Next"></a></div><div id="content">
13
14  <div class="titlepage"><div><div><h1 style="clear: both">Experimental</h1></div></div></div>
15<p>In <code>&lt;boost/outcome/experimental&gt;</code>, there ships an Outcome-based simulation of
16the proposed <a href="https://wg21.link/P1095">P1095 <em>Zero overhead deterministic failure</em></a>
17specific implementation of <a href="http://wg21.link/P0709">P0709 <em>Zero overhead exceptions: Throwing values</em></a>, aka &ldquo;Herbceptions&rdquo;. This library-only implementation lets you use a close simulacrum
18of potential future C++ lightweight exceptions today in <a href="./requirements.html">any C++ 14 compiler
19which Outcome supports</a>.</p>
20
21<div class="notices warning" style="background: url('images/warning.png') top left no-repeat padding-box padding-box;">
22<div class="notices heading">warning</div>
23<div class="notices message"><p><b>It is stressed, in the strongest possible terms, that any item inside
24<code>&lt;boost/outcome/experimental&gt;</code> is subject to unannounced breaking change based
25on WG21 standards committee feedback</b>. That said, the chances are high
26that most of those breaking changes will be to naming rather than to
27fundamental semantics, so you can upgrade with a bit of find and replace.
28There are quite a few large code bases out there
29already using this experimental support in anger, we know it works well
30at scale and it&rsquo;s a good bit superior to <code>std::error_code</code> et al on every
31measure.</p>
32</div>
33</div>
34
35
36<p>P1095&rsquo;s support library has a reference implementation at <a href="https://ned14.github.io/status-code/">https://ned14.github.io/status-code/</a>.
37You will find terse documentation there, and an API reference.
38This library is wholly incorporated into Outcome in the <code>&lt;boost/outcome/experimental/status-code&gt;</code>
39directory, with bindings into Outcome provided in the following headers:</p>
40
41<ul>
42<li><code>&lt;boost/outcome/experimental/status_result.hpp&gt;</code></li>
43<li><code>&lt;boost/outcome/experimental/status_outcome.hpp&gt;</code></li>
44</ul>
45
46<p>These headers import the entire contents of the <code>BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE</code>
47namespace into the <code>BOOST_OUTCOME_V2_NAMESPACE::experimental</code> namespace. You
48can thus address everything in <code>BOOST_OUTCOME_SYSTEM_ERROR2_NAMESPACE</code> via
49<code>BOOST_OUTCOME_V2_NAMESPACE::experimental</code>.</p>
50
51<p>As P1095 also proposes C language support for lightweight C++ exceptions,
52experimental Outcome also has a macro-based C interface that enables C
53code to work with the C-compatible subset of <code>status_result&lt;T, E&gt;</code>:</p>
54
55<ul>
56<li><code>&lt;boost/outcome/experimental/result.h&gt;</code></li>
57</ul>
58
59<p>For non-Windows non-POSIX platforms such as some embedded systems, standalone
60Experimental Outcome can be used with the <code>BOOST_OUTCOME_SYSTEM_ERROR2_NOT_POSIX</code> macro
61defined. This does not include POSIX headers, and makes available a high fidelity,
62fully deterministic, alternative to C++ exceptions on such platforms.</p>
63
64
65
66        </div><p><small>Last revised: February 25, 2020 at 11:15:13 UTC</small></p>
67<hr>
68<div class="spirit-nav">
69<a accesskey="p" href="./recipes/foreign-try.html"><img src="./images/prev.png" alt="Prev"></a>
70    <a accesskey="u" href="./index.html"><img src="./images/up.png" alt="Up"></a>
71    <a accesskey="h" href="./index.html"><img src="./images/home.png" alt="Home"></a><a accesskey="n" href="./experimental/advantages.html"><img src="./images/next.png" alt="Next"></a></div></body>
72</html>
73