• 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>Before we begin - 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/essential.html"><img src="../../images/prev.png" alt="Prev"></a>
11    <a accesskey="u" href="../../tutorial/essential.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/essential/result.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content">
13  <div class="titlepage"><div><div><h1 style="clear: both">Before we begin</h1></div></div></div>
14
15
16<h2 id="outcome-v2-namespace">Outcome v2 namespace</h2>
17
18<p>It is recommended that you refer to entities from this Outcome v2 via the following namespace alias:</p>
19
20<div class="code-snippet"><div class="highlight"><pre class="chroma"><code class="language-c++" data-lang="c++"><span class="k">namespace</span> <span class="n">outcome</span> <span class="o">=</span> <span class="n">BOOST_OUTCOME_V2_NAMESPACE</span><span class="p">;</span>
21</code></pre></div><a href="https://github.com/boostorg/outcome/tree/master/doc/src/snippets/using_result.cpp#L38" class="code-snippet-url" target="_blank">View this code on Github</a></div>
22
23
24<p>On standalone Outcome only, as patches and modifications are applied to this library,
25namespaces get permuted in order to not to cause binary incompatibility. At some point
26namespace <code>outcome_v2</code> will be defined, and this will be the preferred namespace.
27Until then <code>BOOST_OUTCOME_V2_NAMESPACE</code> denotes the most recently
28updated version, getting closer to <code>outcome_v2</code>.</p>
29
30<p>On Boost.Outcome only, as Boost provides no binary compatibility across releases,
31<code>BOOST_OUTCOME_V2_NAMESPACE</code> always expands into <code>boost::outcome_v2</code>.</p>
32
33<h2 id="online-compilers">Online compilers</h2>
34
35<p>If you&rsquo;ve never used them before, you will find
36<a href="https://godbolt.org/">Godbolt</a> and <a href="https://wandbox.org/">Wandbox</a> invaluable.
37These let you play with C++ inside your web browser.</p>
38
39<p>Most of the source code snippets in Outcome have a link in their top right to
40the original source code on github. You can copy and paste this source code into
41Godbolt (if you wish to study the assembler generated) or Wandbox (if you
42wish to run the program).</p>
43
44<h3 id="godbolt">Godbolt</h3>
45
46<p>Godbolt is invaluable for visualising online the assembler generated for a
47piece of C++, for all the major compilers and CPU architectures.</p>
48
49<p>Standalone Outcome is built into Godbolt! In the right hand pane toolbar, click the
50libraries dropdown (currently third from the right, looks like a book), find
51Outcome and choose the version you want.</p>
52
53<p>After this is selected, you can <code>#include</code> any of these editions of Outcome:</p>
54
55<dl>
56  <dt><code>&lt;outcome-basic.hpp&gt;</code></dt>
57  <dd>An inclusion of <code>basic_outcome.hpp</code> + <code>try.hpp</code> which includes as few
58  system headers as possible in order to give an absolute minimum compile time
59  impact edition of Outcome. See <a href="https://github.com/ned14/stl-header-heft">https://github.com/ned14/stl-header-heft</a>.
60  </dd>
61  <dt><code>&lt;outcome-experimental.hpp&gt;</code></dt>
62  <dd>An inclusion of <code>experimental/status_outcome.hpp</code> + <code>try.hpp</code> which
63  is the low compile time impact of the basic edition combined with
64  <code>status_code</code> from <a href="https://ned14.github.io/status-code/">https://ned14.github.io/status-code/</a>. If you are on an
65  embedded system where binary bloat must be absolutely avoided, and don't
66  mind the potentially unstable <code>status_code</code>, this is definitely the edition
67  for you.
68  </dd>
69  <dt><code>&lt;outcome.hpp&gt;</code></dt>
70  <dd>An inclusion of <code>outcome.hpp</code> which brings in all the specialisations
71  for the <code>std</code> STL types, plus iostreams support. If you don't know which
72  edition to use, you should use this one, it ought to "just work".</dd>
73</dl>
74
75<p>Here is the first tutorial topic&rsquo;s source code loaded into Godbolt: <a href="https://godbolt.org/z/p-NAho">https://godbolt.org/z/p-NAho</a></p>
76
77<h3 id="wandbox">Wandbox</h3>
78
79<p>Wandbox lets you place a third party header into a separate tab. It also
80comes with a recent Boost libraries. Either technique can be used to
81explore Outcome.</p>
82
83<p>Here is the first tutorial topic&rsquo;s source code loaded into Wandbox: <a href="https://wandbox.org/permlink/sJoeKHXSyCU5Avft">https://wandbox.org/permlink/sJoeKHXSyCU5Avft</a></p>
84
85
86        </div><p><small>Last revised: February 09, 2019 at 14:45:47 UTC</small></p>
87<hr>
88<div class="spirit-nav">
89<a accesskey="p" href="../../tutorial/essential.html"><img src="../../images/prev.png" alt="Prev"></a>
90    <a accesskey="u" href="../../tutorial/essential.html"><img src="../../images/up.png" alt="Up"></a>
91    <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../tutorial/essential/result.html"><img src="../../images/next.png" alt="Next"></a></div></body>
92</html>
93