• 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>throw_bad_result_access&lt;EC&gt; - 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="../../reference/policies/terminate.html"><img src="../../images/prev.png" alt="Prev"></a>
11    <a accesskey="u" href="../../reference/policies.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="../../reference/types.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content">
13  <div class="titlepage"><div><div><h1 style="clear: both"><code>throw_bad_result_access&lt;EC&gt;</code></h1></div></div></div>
14  <p>Policy class defining that <a href="../../reference/types/bad_result_access_with.html" class="api-reference"><code>bad_result_access_with&lt;EC&gt;</code></a>
15 should be thrown on incorrect wide value observation. The primary purpose of this policy is to enable standing in for
16<a href="https://wg21.link/P0323" class="api-reference" target="_blank"><i class="fa fa-book" aria-hidden="true"></i> P0323 <code>std::expected&lt;T, E&gt;</code></a>
17 which throws a <code>bad_expected_access&lt;E&gt;</code> on incorrect wide value observation. This is why it is only ever <code>EC</code> which is thrown with <code>bad_result_access_with&lt;EC&gt;</code> on value observation only, and only when there is an error available.</p>
18
19<p>If used in <code>basic_outcome</code>, and the outcome is exceptioned and so no error is available, incorrect wide value observation performs instead:</p>
20<div class="highlight"><pre class="chroma"><code class="language-c++" data-lang="c++"><span class="n">BOOST_OUTCOME_THROW_EXCEPTION</span><span class="p">(</span><span class="n">bad_result_access</span><span class="p">(</span><span class="s">&#34;no value&#34;</span><span class="p">));</span>
21</code></pre></div>
22<p>Incorrect wide error observation performs:</p>
23<div class="highlight"><pre class="chroma"><code class="language-c++" data-lang="c++"><span class="n">BOOST_OUTCOME_THROW_EXCEPTION</span><span class="p">(</span><span class="n">bad_result_access</span><span class="p">(</span><span class="s">&#34;no error&#34;</span><span class="p">));</span>
24</code></pre></div>
25<p>Incorrect wide exception observation performs:</p>
26<div class="highlight"><pre class="chroma"><code class="language-c++" data-lang="c++"><span class="n">BOOST_OUTCOME_THROW_EXCEPTION</span><span class="p">(</span><span class="n">bad_outcome_access</span><span class="p">(</span><span class="s">&#34;no exception&#34;</span><span class="p">));</span>
27</code></pre></div>
28<p>Inherits publicly from <a href="../../reference/policies/base.html" class="api-reference"><code>base</code></a>
29, and its narrow value, error and exception observer policies are inherited from there.</p>
30
31<p><em>Requires</em>: Nothing.</p>
32
33<p><em>Namespace</em>: <code>BOOST_OUTCOME_V2_NAMESPACE::policy</code></p>
34
35<p><em>Header</em>: <code>&lt;boost/outcome/policy/throw_bad_result_access.hpp&gt;</code></p>
36
37
38        </div><p><small>Last revised: January 23, 2019 at 01:27:31 UTC</small></p>
39<hr>
40<div class="spirit-nav">
41<a accesskey="p" href="../../reference/policies/terminate.html"><img src="../../images/prev.png" alt="Prev"></a>
42    <a accesskey="u" href="../../reference/policies.html"><img src="../../images/up.png" alt="Up"></a>
43    <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/types.html"><img src="../../images/next.png" alt="Next"></a></div></body>
44</html>
45