123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>The main advantages - Boost.Outcome documentation</title>
- <link rel="stylesheet" href="../css/boost.css" type="text/css">
- <meta name="generator" content="Hugo 0.52 with Boostdoc theme">
- <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
- <link rel="icon" href="../images/favicon.ico" type="image/ico"/>
- <body><div class="spirit-nav">
- <a accesskey="p" href="../experimental.html"><img src="../images/prev.png" alt="Prev"></a>
- <a accesskey="u" href="../experimental.html"><img src="../images/up.png" alt="Up"></a>
- <a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../experimental/map.html"><img src="../images/next.png" alt="Next"></a></div><div id="content">
- <div class="titlepage"><div><div><h1 style="clear: both">The main advantages</h1></div></div></div>
- <p>The main advantages of choosing <code><boost/outcome/experimental></code> over default Outcome:</p>
- <ol>
- <li><p>Codegen is tighter and less verbose<sup class="footnote-ref" id="fnref:1"><a href="#fn:1">1</a></sup>, sometimes remarkably so.</p></li>
- <li><p>Build time impact is markedly lower, barely above the inclusion of naked
- <code><basic_result.hpp></code>, as the STL allocator machinery and <code>std::string</code> et al
- is not dragged into inclusion by including <code><system_error></code>. Note that
- <code><boost/outcome/experimental/status_outcome.hpp></code> bring in <code><exception></code>,
- however <code><boost/outcome/experimental/status_result.hpp></code> brings in no extra system
- headers.</p></li>
- <li><p>More discipline is imposed on your use of Outcome, leading to
- less ambiguous code which is easier to optimise by the compiler,
- lower cost to maintain, and lower cognitive load to audit code based on
- experimental Outcome for correctness.</p></li>
- <li><p>Code written to <code><boost/outcome/experimental></code> can be fairly easily dual
- targeted, with just a few switching type aliases, to default Outcome.
- This author has several Outcome-based libraries with identical source code which
- can target either configuration of Outcome. The experimental Outcome
- build regularly beats the default Outcome build in benchmarks by 2-3%,
- and the dual target source code, being written to tighter discipline,
- is faster and more deterministic in the default target than it was before
- the (non-trivial) port to <code><boost/outcome/experimental></code>.</p></li>
- </ol>
- <p>If you are building a codebase on top of Outcome expecting long term
- maintenance, the author’s personal recommendation is that you design, write, test and
- optimise it for <code><boost/outcome/experimental></code>. What you ship to your customers
- ought to be targeted at default Outcome however, so employ type aliases and
- macros as appropriate to switch the build configuration for production releases.
- This is what the Outcome author does himself, to date with great success,
- despite the fundamental architectural differences between <code><system_error></code>
- and proposed <code><system_error2></code>.</p>
- <div class="footnotes">
- <hr />
- <ol>
- <li id="fn:1">Boost.System’s <code>error_code</code> has incorporated some of the design improvements of experimental <code>status_code</code>, and produces codegen somewhere in between experimental <code>status_code</code> and <code>std::error_code</code>.
- <a class="footnote-return" href="#fnref:1"><sup>[return]</sup></a></li>
- </ol>
- </div>
- </div><p><small>Last revised: February 05, 2019 at 21:41:47 UTC</small></p>
- <hr>
- <div class="spirit-nav">
- <a accesskey="p" href="../experimental.html"><img src="../images/prev.png" alt="Prev"></a>
- <a accesskey="u" href="../experimental.html"><img src="../images/up.png" alt="Up"></a>
- <a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../experimental/map.html"><img src="../images/next.png" alt="Next"></a></div></body>
- </html>
|