Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / outcome / doc / html / reference / types / basic_result.html
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>basic_result&lt;T, E, NoValuePolicy&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/types/basic_outcome/as_failure_rvalue.html"><img src="../../images/prev.png" alt="Prev"></a>
11     <a accesskey="u" href="../../reference/types.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/basic_result/default.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content">
13
14   <div class="titlepage"><div><div><h1 style="clear: both"><code>basic_result&lt;T, E, NoValuePolicy&gt;</code></h1></div></div></div>
15   <div class="toc"><dl class="toc">
16 <dt>
17 <dd><dl>
18 <dt>
19 <dd><dl>
20 <dt><a href="#design-rationale">Design rationale</a></dt>
21 <dt><a href="#public-member-type-aliases">Public member type aliases</a></dt>
22 <dt><a href="#protected-member-predicate-booleans">Protected member predicate booleans</a>
23 <dd><dl>
24 <dt><a href="#summary-of-standard-requirements-provided-https-en-cppreference-com-w-cpp-named-req">Summary of <a href="https://en.cppreference.com/w/cpp/named_req">standard requirements provided</a></a></dt>
25 </dl></dd></dt>
26 <dt><a href="#public-member-functions">Public member functions</a>
27 <dd><dl>
28 <dt><a href="#disabling-constructors">Disabling constructors</a></dt>
29 </dl></dd></dt>
30 </dl></dd></dt>
31 </dl></dd></dt>
32 </dl>
33   </div>
34
35
36 <p>A sum type carrying either a <code>T</code> or an <code>E</code>, with <code>NoValuePolicy</code> specifying what to do if one tries to read state which isn&rsquo;t there. Either or both of <code>T</code> and <code>E</code> can be <code>void</code> to indicate no value for that state is present. Note that <code>E = void</code> makes basic result into effectively an <code>optional&lt;T&gt;</code>, but with <code>NoValuePolicy</code> configurable behaviour. Detectable using <a href="../../reference/traits/is_basic_result.html" class="api-reference"><code>is_basic_result&lt;T&gt;</code></a>
37 .</p>
38
39 <p><em>Requires</em>: Concept requirements if C++ 20, else static asserted:</p>
40
41 <ul>
42 <li>That trait <a href="../../reference/traits/type_can_be_used_in_basic_result.html" class="api-reference"><code>type_can_be_used_in_basic_result&lt;R&gt;</code></a>
43  is true for both <code>T</code> and <code>E</code>.</li>
44 <li>That either <code>E</code> is <code>void</code> or <code>DefaultConstructible</code>.</li>
45 </ul>
46
47 <p><em>Namespace</em>: <code>BOOST_OUTCOME_V2_NAMESPACE</code></p>
48
49 <p><em>Header</em>: <code>&lt;boost/outcome/basic_result.hpp&gt;</code></p>
50
51 <p><em>Inclusions</em>: The very lightest weight of C and C++ header files:</p>
52
53 <ol>
54 <li><code>&lt;cstdint&gt;</code></li>
55 <li><code>&lt;initializer_list&gt;</code></li>
56 <li><code>&lt;iosfwd&gt;</code></li>
57 <li><code>&lt;new&gt;</code></li>
58 <li><code>&lt;type_traits&gt;</code></li>
59 <li>If <a href="../../reference/macros/in_place_type.html" class="api-reference"><code>BOOST_OUTCOME_USE_STD_IN_PLACE_TYPE</code></a>
60  is <code>1</code>, <code>&lt;utility&gt;</code> (defaults to <code>1</code> for C++ 17 or later only)</li>
61 <li>If C++ exceptions disabled and <code>BOOST_OUTCOME_DISABLE_EXECINFO</code> undefined only (used to print stack backtraces on &ldquo;exception throw&rdquo;):
62
63 <ol>
64 <li><code>&lt;sal.h&gt;</code> (Windows only)</li>
65 <li><code>&lt;stddef.h&gt;</code> (Windows only)</li>
66 <li><code>&lt;string.h&gt;</code> (Windows only)</li>
67 <li><code>&lt;execinfo.h&gt;</code> (POSIX only)</li>
68 </ol></li>
69 <li><code>&lt;cstdio&gt;</code></li>
70 <li><code>&lt;cstdlib&gt;</code></li>
71 <li><code>&lt;cassert&gt;</code></li>
72 </ol>
73
74 <p>This very light weight set of inclusion dependencies makes basic result suitable for use in global header files of very large C++ codebases.</p>
75
76 <h3 id="design-rationale">Design rationale</h3>
77
78 <p>The basic result type is the main workhorse type of the Outcome library, providing a simple sum type with optional values representing success or disappointment. Unlike 
79 <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>
80 , Outcome&rsquo;s result type is designed specifically for convenience when implementing failure handling across very large codebases, and it has a number of API differences to facilitate that.</p>
81
82 <p>The first major design difference is that basic result models its constructor design on 
83 <a href="https://en.cppreference.com/w/cpp/utility/variant" class="api-reference" target="_blank"><i class="fa fa-book" aria-hidden="true"></i> <code>std::variant&lt;...&gt;</code></a>
84 , rather than modelling 
85 <a href="https://en.cppreference.com/w/cpp/utility/optional" class="api-reference" target="_blank"><i class="fa fa-book" aria-hidden="true"></i> <code>std::optional&lt;T&gt;</code></a>
86 &rsquo;s constructor design like <code>std::expected&lt;T, E&gt;</code> does. This means that basic result will implicitly construct either a <code>T</code> or an <code>E</code> if doing so is unambiguous, same as <code>variant</code> does. Where implicit construction is ambiguous, the implicit constructors disable and a <code>T</code> or <code>E</code> can be specified via <a href="../../reference/types/in_place_type_t.html" class="api-reference"><code>in_place_type_t&lt;T&gt;</code></a>
87 , or via <a href="../../reference/types/success_type.html" class="api-reference"><code>success_type&lt;T&gt;</code></a>
88  or <a href="../../reference/traits/is_failure_type.html" class="api-reference"><code>failure_type&lt;T&gt;</code></a>
89 . We implement a subset of variant&rsquo;s constructors for improved compile time impact, so the implicit and explicit constructor design is split into fixed subsets to reduce SFINAE execution.</p>
90
91 <p>The second major design difference is that union storage is NOT used, as it is assumed that <code>sizeof(E)</code> will be small for failure handling. This very considerably reduces load on the compiler, and substantially improves compile times in very large C++ 14 codebases, because copies and moves do not need to jump through complex ceremony in order to implement the never-empty guarantees which would be required in a union storage based implementation (C++ 17 onwards does far fewer copy and move constructor instantiations, but it all adds up &ndash; work avoided is always the fastest).</p>
92
93 <h3 id="public-member-type-aliases">Public member type aliases</h3>
94
95 <ul>
96 <li><code>value_type</code> is <code>T</code>.</li>
97 <li><code>error_type</code> is <code>E</code>.</li>
98 <li><code>value_type_if_enabled</code> is <code>T</code> if construction from <code>T</code> is available, else it is a usefully named unusable internal type.</li>
99 <li><code>error_type_if_enabled</code> is <code>E</code> if construction from <code>E</code> is available, else it is a usefully named unusable internal type.</li>
100 <li><code>rebind&lt;A, B = E, C = NoValuePolicy&gt;</code> is <code>basic_result&lt;A, B, C&gt;</code>.</li>
101 </ul>
102
103 <h3 id="protected-member-predicate-booleans">Protected member predicate booleans</h3>
104
105 <ul>
106 <li><p><code>predicate::constructors_enabled</code> is constexpr boolean true if decayed <code>value_type</code> and decayed <code>error_type</code> are not the same type.</p></li>
107
108 <li><p><code>predicate::implicit_constructors_enabled</code> is constexpr boolean true if:</p>
109
110 <ol>
111 <li><code>predicate::constructors_enabled</code> is true.</li>
112 <li>Trait <a href="../../reference/traits/is_error_type.html" class="api-reference"><code>is_error_type&lt;E&gt;</code></a>
113  is not true for both decayed <code>value_type</code> and decayed <code>error_type</code> at the same time.</li>
114 <li><code>value_type</code> is not implicitly constructible from <code>error_type</code> and <code>error_type</code> is not implicitly constructible from <code>value_type</code>.<br>OR<br>trait <a href="../../reference/traits/is_error_type.html" class="api-reference"><code>is_error_type&lt;E&gt;</code></a>
115  is true for decayed <code>error_type</code> and <code>error_type</code> is not implicitly constructible from <code>value_type</code> and <code>value_type</code> is an integral type.</li>
116 </ol></li>
117
118 <li><p><code>predicate::enable_value_converting_constructor&lt;A&gt;</code> is constexpr boolean true if:</p>
119
120 <ol>
121 <li><code>predicate::constructors_enabled</code> is true.</li>
122 <li>Decayed <code>A</code> is not this <code>basic_result</code> type.</li>
123 <li><code>predicate::implicit_constructors_enabled</code> is true.</li>
124 <li>Decayed <code>A</code> is not an <code>in_place_type_t</code>.</li>
125 <li>Trait <a href="../../reference/traits/is_error_type_enum.html" class="api-reference"><code>is_error_type_enum&lt;E, Enum&gt;</code></a>
126  is false for <code>error_type</code> and decayed <code>A</code>.</li>
127 <li><code>value_type</code> is implicitly constructible from <code>A</code> and <code>error_type</code> is not implicitly constructible from <code>A</code>.<br>OR<br><code>value_type</code> is the exact same type as decayed <code>A</code> and <code>value_type</code> is implicitly constructible from <code>A</code>.</li>
128 </ol></li>
129
130 <li><p><code>predicate::enable_error_converting_constructor&lt;A&gt;</code> is constexpr boolean true if:</p>
131
132 <ol>
133 <li><code>predicate::constructors_enabled</code> is true.</li>
134 <li>Decayed <code>A</code> is not this <code>basic_result</code> type.</li>
135 <li><code>predicate::implicit_constructors_enabled</code> is true.</li>
136 <li>Decayed <code>A</code> is not an <code>in_place_type_t</code>.</li>
137 <li>Trait <a href="../../reference/traits/is_error_type_enum.html" class="api-reference"><code>is_error_type_enum&lt;E, Enum&gt;</code></a>
138  is false for <code>error_type</code> and decayed <code>A</code>.</li>
139 <li><code>value_type</code> is not implicitly constructible from <code>A</code> and <code>error_type</code> is implicitly constructible from <code>A</code>.<br>OR<br><code>error_type</code> is the exact same type as decayed <code>A</code> and <code>error_type</code> is implicitly constructible from <code>A</code>.</li>
140 </ol></li>
141
142 <li><p><code>predicate::enable_error_condition_converting_constructor&lt;ErrorCondEnum&gt;</code> is constexpr boolean true if:</p>
143
144 <ol>
145 <li><code>predicate::constructors_enabled</code> is true.</li>
146 <li>Decayed <code>ErrorCondEnum</code> is not this <code>basic_result</code> type.</li>
147 <li>Decayed <code>ErrorCondEnum</code> is not an <code>in_place_type_t</code>.</li>
148 <li>Trait <a href="../../reference/traits/is_error_type_enum.html" class="api-reference"><code>is_error_type_enum&lt;E, Enum&gt;</code></a>
149  is true for <code>error_type</code> and decayed <code>ErrorCondEnum</code>.</li>
150 </ol></li>
151
152 <li><p><code>predicate::enable_compatible_conversion&lt;A, B, C&gt;</code> is constexpr boolean true if:</p>
153
154 <ol>
155 <li><code>predicate::constructors_enabled</code> is true.</li>
156 <li><code>basic_result&lt;A, B, C&gt;</code> is not this <code>basic_result</code> type.</li>
157 <li><code>A</code> is <code>void</code> OR <code>value_type</code> is explicitly constructible from <code>A</code>.</li>
158 <li><code>B</code> is <code>void</code> OR <code>error_type</code> is explicitly constructible from <code>B</code>.</li>
159 </ol></li>
160
161 <li><p><code>predicate::enable_make_error_code_compatible_conversion&lt;A, B, C&gt;</code> is constexpr boolean true if:</p>
162
163 <ol>
164 <li><code>predicate::constructors_enabled</code> is true.</li>
165 <li><code>basic_result&lt;A, B, C&gt;</code> is not this <code>basic_result</code> type.</li>
166 <li>Trait &#34;/home/travis/build/ned14/boost-outcome/doc/src/content/reference/types/basic_result/_index.md:92:14&#34;: API reference page for &#39;is_error_code_available&lt;E&gt;&#39; not found, please use an identifier wholly contained in a page title
167     <b>API NOT FOUND IN DOCS <code>is_error_code_available&lt;E&gt;</code></b>
168  is true for decayed <code>error_type</code>.</li>
169 <li><code>predicate::enable_compatible_conversion&lt;A, B, C&gt;</code> is not true.</li>
170 <li><code>A</code> is <code>void</code> OR <code>value_type</code> is explicitly constructible from <code>A</code>.</li>
171 <li><code>error_type</code> is explicitly constructible from <code>make_error_code(B)</code>.</li>
172 </ol></li>
173
174 <li><p><code>predicate::enable_make_exception_ptr_compatible_conversion&lt;A, B, C&gt;</code> is constexpr boolean true if:</p>
175
176 <ol>
177 <li><code>predicate::constructors_enabled</code> is true.</li>
178 <li><code>basic_result&lt;A, B, C&gt;</code> is not this <code>basic_result</code> type.</li>
179 <li>Trait &#34;/home/travis/build/ned14/boost-outcome/doc/src/content/reference/types/basic_result/_index.md:100:14&#34;: API reference page for &#39;is_exception_ptr_available&lt;E&gt;&#39; not found, please use an identifier wholly contained in a page title
180     <b>API NOT FOUND IN DOCS <code>is_exception_ptr_available&lt;E&gt;</code></b>
181  is true for decayed <code>error_type</code>.</li>
182 <li><code>predicate::enable_compatible_conversion&lt;A, B, C&gt;</code> is not true.</li>
183 <li><code>A</code> is <code>void</code> OR <code>value_type</code> is explicitly constructible from <code>A</code>.</li>
184 <li><code>error_type</code> is explicitly constructible from <code>make_exception_ptr(B)</code>.</li>
185 </ol></li>
186
187 <li><p><code>predicate::enable_inplace_value_constructor&lt;Args...&gt;</code> is constexpr boolean true if:</p>
188
189 <ol>
190 <li><code>predicate::constructors_enabled</code> is true.</li>
191 <li><code>value_type</code> is <code>void</code> OR <code>value_type</code> is explicitly constructible from <code>Args...</code>.</li>
192 </ol></li>
193
194 <li><p><code>predicate::enable_inplace_error_constructor&lt;Args...&gt;</code> is constexpr boolean true if:</p>
195
196 <ol>
197 <li><code>predicate::constructors_enabled</code> is true.</li>
198 <li><code>error_type</code> is <code>void</code> OR <code>error_type</code> is explicitly constructible from <code>Args...</code>.</li>
199 </ol></li>
200
201 <li><p><code>predicate::enable_inplace_value_error_constructor&lt;Args...&gt;</code> is constexpr boolean true if:</p>
202
203 <ol>
204 <li><code>predicate::constructors_enabled</code> is true.</li>
205 <li><code>predicate::implicit_constructors_enabled</code> is true.</li>
206 <li>Either, but not both, of <code>value_type</code> is explicitly constructible from <code>Args...</code> or <code>error_type</code> is explicitly constructible from <code>Args...</code>.</li>
207 </ol></li>
208 </ul>
209
210 <h4 id="summary-of-standard-requirements-provided-https-en-cppreference-com-w-cpp-named-req">Summary of <a href="https://en.cppreference.com/w/cpp/named_req">standard requirements provided</a></h4>
211
212 <ul>
213 <li><del><code>DefaultConstructible</code></del>, always deleted to force user to choose valued or errored for every result instanced.</li>
214 <li><code>MoveConstructible</code>, if both <code>value_type</code> and <code>error_type</code> implement move constructors.</li>
215 <li><code>CopyConstructible</code>, if both <code>value_type</code> and <code>error_type</code> implement copy constructors.</li>
216 <li><code>MoveAssignable</code>, if both <code>value_type</code> and <code>error_type</code> implement move constructors and move assignment.</li>
217 <li><code>CopyAssignable</code>, if both <code>value_type</code> and <code>error_type</code> implement copy constructors and copy assignment.</li>
218 <li><code>Destructible</code>.</li>
219 <li><code>TriviallyCopyable</code>, if both <code>value_type</code> and <code>error_type</code> are trivially copyable.</li>
220 <li><code>TrivialType</code>, if both <code>value_type</code> and <code>error_type</code> are trivial types.</li>
221 <li><code>LiteralType</code>, if both <code>value_type</code> and <code>error_type</code> are literal types.</li>
222
223 <li><p><code>StandardLayoutType</code>, if both <code>value_type</code> and <code>error_type</code> are standard layout types. If so, layout of <code>basic_result</code> in C is guaranteed to be:</p>
224 <div class="highlight"><pre class="chroma"><code class="language-c++" data-lang="c++"><span class="k">struct</span> <span class="n">result_layout</span> <span class="p">{</span>
225   <span class="n">value_type</span> <span class="n">value</span><span class="p">;</span>
226   <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">flags</span><span class="p">;</span>
227   <span class="n">error_type</span> <span class="n">error</span><span class="p">;</span>
228 <span class="p">};</span>
229 </code></pre></div></li>
230
231 <li><p><code>EqualityComparable</code>, if both <code>value_type</code> and <code>error_type</code> implement equality comparisons with one another.</p></li>
232
233 <li><p><del><code>LessThanComparable</code></del>, not implemented due to availability of implicit conversions from <code>value_type</code> and <code>error_type</code>, this can cause major surprise (i.e. hard to diagnose bugs), so we don&rsquo;t implement these at all.
234 ~ <code>Swappable</code></p></li>
235
236 <li><p><del><code>Hash</code></del>, not implemented as a generic implementation of a unique hash for non-valued items which are unequal would require a dependency on RTTI being enabled.</p></li>
237 </ul>
238
239 <p>Thus <code>basic_result</code> meets the <code>Regular</code> concept if both <code>value_type</code> and <code>error_type</code> are <code>Regular</code>, except for the lack of a default constructor. Often where one needs a default constructor, wrapping <code>basic_result</code> into 
240 <a href="https://en.cppreference.com/w/cpp/utility/optional" class="api-reference" target="_blank"><i class="fa fa-book" aria-hidden="true"></i> <code>std::optional&lt;T&gt;</code></a>
241  will suffice.</p>
242
243 <h3 id="public-member-functions">Public member functions</h3>
244
245 <h4 id="disabling-constructors">Disabling constructors</h4>
246
247 <ol class="children children-li"><li>
248         <a href="../../reference/types/basic_result/disabling_catchall.html" ><code>basic_result(Args...) = delete</code></a>
249 <p>Disabling catchall constructor used to give useful diagnostic error when trying to use non-inplace constructors when <code>predicate::constructors_enabled</code> is false.</p><li>
250         <a href="../../reference/types/basic_result/disabling_implicit_constructor.html" ><code>basic_result(X &amp;&amp;) = delete</code></a>
251 <p>Disabling implicit constructor used to give useful diagnostic error when trying to use implicit constructors when <code>predicate::implicit_constructors_enabled</code> is false.</p></li></ol>
252
253 <h4 id="copy-and-move-constructors-and-assignment-and-destructor">Copy and move constructors and assignment, and destructor</h4>
254
255 <ol class="children children-li"><li>
256     <a href="../../reference/types/basic_result/default.html" ><code>basic_result() = delete</code></a>
257 <p>The default constructor (disabled).</p><li>
258     <a href="../../reference/types/basic_result/move_constructor.html" ><code>basic_result(basic_result &amp;&amp;)</code></a>
259 <p>Move constructor. Constexpr, triviality and noexcept propagating.</p><li>
260     <a href="../../reference/types/basic_result/copy_constructor.html" ><code>basic_result(const basic_result &amp;)</code></a>
261 <p>Copy constructor. Constexpr, triviality and noexcept propagating.</p><li>
262     <a href="../../reference/types/basic_result/move_assignment.html" ><code>basic_result &amp;operator=(basic_result &amp;&amp;)</code></a>
263 <p>Move assignment. Constexpr, triviality and noexcept propagating.</p><li>
264     <a href="../../reference/types/basic_result/copy_assignment.html" ><code>basic_result &amp;operator=(const basic_result &amp;)</code></a>
265 <p>Copy assignment. Constexpr, triviality and noexcept propagating.</p><li>
266     <a href="../../reference/types/basic_result/destructor.html" ><code>~basic_result()</code></a>
267 <p>Destructor. Constexpr, triviality and noexcept propagating.</p></li></ol>
268
269 <h4 id="converting-constructors">Converting constructors</h4>
270
271 <ol class="children children-li"><li>
272     <a href="../../reference/types/basic_result/implicit_value_converting_constructor.html" ><code>basic_result(R &amp;&amp;)</code></a>
273 <p>Implicit <code>value_type</code> constructor. Available if <code>predicate::enable_value_converting_constructor&lt;R&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
274     <a href="../../reference/types/basic_result/implicit_error_converting_constructor.html" ><code>basic_result(S &amp;&amp;)</code></a>
275 <p>Implicit <code>error_type</code> constructor. Available if <code>predicate::enable_error_converting_constructor&lt;S&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
276     <a href="../../reference/types/basic_result/implicit_error_condition_converting_constructor.html" ><code>basic_result(ErrorCondEnum &amp;&amp;)</code></a>
277 <p>Implicit <code>error_type</code> from <code>ErrorCondEnum</code> constructor. Available if <code>predicate::enable_error_condition_converting_constructor&lt;ErrorCondEnum&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
278     <a href="../../reference/types/basic_result/explicit_valueorerror_converting_constructor.html" ><code>explicit basic_result(ValueOrError&lt;T, E&gt; &amp;&amp;)</code></a>
279 <p>Explicit converting constructor from <code>ValueOrError&lt;T, E&gt;</code> concept matching types. Available if <code>convert::value_or_error&lt;&gt;</code> permits it. Constexpr, triviality and noexcept propagating.</p><li>
280     <a href="../../reference/types/basic_result/explicit_copy_converting_constructor.html" ><code>explicit basic_result(const basic_result&lt;R, S, P&gt; &amp;)</code></a>
281 <p>Explicit converting copy constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_compatible_conversion&lt;R, S, P&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
282     <a href="../../reference/types/basic_result/explicit_move_converting_constructor.html" ><code>explicit basic_result(basic_result&lt;R, S, P&gt; &amp;&amp;)</code></a>
283 <p>Explicit converting move constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_compatible_conversion&lt;R, S, P&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
284     <a href="../../reference/types/basic_result/explicit_make_error_code_copy_converting_constructor.html" ><code>explicit basic_result(const basic_result&lt;R, S, P&gt; &amp;)</code></a>
285 <p>Explicit converting copy constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_make_error_code_compatible_conversion&lt;R, S, P&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
286     <a href="../../reference/types/basic_result/explicit_make_error_code_move_converting_constructor.html" ><code>explicit basic_result(basic_result&lt;R, S, P&gt; &amp;&amp;)</code></a>
287 <p>Explicit converting move constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_make_error_code_compatible_conversion&lt;R, S, P&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
288     <a href="../../reference/types/basic_result/explicit_make_exception_ptr_copy_converting_constructor.html" ><code>explicit basic_result(const basic_result&lt;R, S, P&gt; &amp;)</code></a>
289 <p>Explicit converting copy constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_make_exception_ptr_compatible_conversion&lt;R, S, P&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
290     <a href="../../reference/types/basic_result/explicit_make_exception_ptr_move_converting_constructor.html" ><code>explicit basic_result(basic_result&lt;R, S, P&gt; &amp;&amp;)</code></a>
291 <p>Explicit converting move constructor from compatible <code>basic_result</code>. Available if <code>predicate::enable_make_exception_ptr_compatible_conversion&lt;R, S, P&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p></li></ol>
292
293 <h4 id="inplace-constructors">Inplace constructors</h4>
294
295 <ol class="children children-li"><li>
296     <a href="../../reference/types/basic_result/explicit_inplace_value_constructor.html" ><code>explicit basic_result(in_place_type_t&lt;value_type_if_enabled&gt;, Args ...)</code></a>
297 <p>Explicit inplace value constructor. Available if <code>predicate::enable_inplace_value_constructor&lt;Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
298     <a href="../../reference/types/basic_result/explicit_inplace_value_constructor_il.html" ><code>explicit basic_result(in_place_type_t&lt;value_type_if_enabled&gt;, std::initializer_list&lt;U&gt;, Args ...)</code></a>
299 <p>Explicit inplace value constructor. Available if <code>predicate::enable_inplace_value_constructor&lt;std::initializer_list&lt;U&gt;, Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
300     <a href="../../reference/types/basic_result/explicit_inplace_error_constructor.html" ><code>explicit basic_result(in_place_type_t&lt;error_type_if_enabled&gt;, Args ...)</code></a>
301 <p>Explicit inplace error constructor. Available if <code>predicate::enable_inplace_error_constructor&lt;Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
302     <a href="../../reference/types/basic_result/explicit_inplace_error_constructor_il.html" ><code>explicit basic_result(in_place_type_t&lt;error_type_if_enabled&gt;, std::initializer_list&lt;U&gt;, Args ...)</code></a>
303 <p>Explicit inplace error constructor. Available if <code>predicate::enable_inplace_error_constructor&lt;std::initializer_list&lt;U&gt;, Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p><li>
304     <a href="../../reference/types/basic_result/implicit_inplace_value_error_constructor.html" ><code>basic_result(A1 &amp;&amp;, A2 &amp;&amp;, Args ...)</code></a>
305 <p>Implicit inplace value or error constructor. Available if <code>predicate::enable_inplace_value_error_constructor&lt;A1, A2, Args ...&gt;</code> is true. Constexpr, triviality and noexcept propagating.</p></li></ol>
306
307 <h4 id="tagged-constructors">Tagged constructors</h4>
308
309 <ol class="children children-li"><li>
310     <a href="../../reference/types/basic_result/implicit_success_copy_constructor.html" ><code>basic_result(const success_type&lt;T&gt; &amp;)</code></a>
311 <p>Implicit value-from-success-type-sugar copy constructor. Available if <code>predicate::enable_compatible_conversion&lt;T, void, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
312     <a href="../../reference/types/basic_result/implicit_success_move_constructor.html" ><code>basic_result(success_type&lt;T&gt; &amp;&amp;)</code></a>
313 <p>Implicit value-from-success-type-sugar move constructor. Available if <code>predicate::enable_compatible_conversion&lt;T, void, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
314     <a href="../../reference/types/basic_result/implicit_failure_copy_constructor.html" ><code>basic_result(const failure_type&lt;T&gt; &amp;)</code></a>
315 <p>Implicit error-from-failure-type-sugar copy constructor. Available if <code>predicate::enable_compatible_conversion&lt;void, T, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
316     <a href="../../reference/types/basic_result/implicit_failure_move_constructor.html" ><code>basic_result(failure_type&lt;T&gt; &amp;&amp;)</code></a>
317 <p>Implicit error-from-failure-type-sugar move constructor. Available if <code>predicate::enable_compatible_conversion&lt;void, T, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
318     <a href="../../reference/types/basic_result/implicit_failure_make_error_code_copy_constructor.html" ><code>basic_result(const failure_type&lt;T&gt; &amp;)</code></a>
319 <p>Implicit error-from-failure-type-sugar copy constructor. Available if <code>predicate::enable_make_error_code_compatible_conversion&lt;void, T, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
320     <a href="../../reference/types/basic_result/implicit_failure_make_error_code_move_constructor.html" ><code>basic_result(failure_type&lt;T&gt; &amp;&amp;)</code></a>
321 <p>Implicit error-from-failure-type-sugar move constructor. Available if <code>predicate::enable_make_error_code_compatible_conversion&lt;void, T, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
322     <a href="../../reference/types/basic_result/implicit_failure_make_exception_ptr_copy_constructor.html" ><code>basic_result(const failure_type&lt;T&gt; &amp;)</code></a>
323 <p>Implicit error-from-failure-type-sugar copy constructor. Available if <code>predicate::enable_make_exception_ptr_compatible_conversion&lt;void, T, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p><li>
324     <a href="../../reference/types/basic_result/implicit_failure_make_exception_ptr_move_constructor.html" ><code>basic_result(failure_type&lt;T&gt; &amp;&amp;)</code></a>
325 <p>Implicit error-from-failure-type-sugar move constructor. Available if <code>predicate::enable_make_exception_ptr_compatible_conversion&lt;void, T, void&gt;</code> is true, or <code>T</code> is <code>void</code>. Constexpr, triviality and noexcept propagating.</p></li></ol>
326
327 <h4 id="observers">Observers</h4>
328
329 <ol class="children children-li"><li>
330     <a href="../../reference/types/basic_result/operator_bool.html" ><code>explicit operator bool() const noexcept</code></a>
331 <p>Returns true if a value is present. Constexpr, never throws.</p><li>
332     <a href="../../reference/types/basic_result/has_value.html" ><code>bool has_value() const noexcept</code></a>
333 <p>Returns true if a value is present. Constexpr, never throws.</p><li>
334     <a href="../../reference/types/basic_result/has_error.html" ><code>bool has_error() const noexcept</code></a>
335 <p>Returns true if an error is present. Constexpr, never throws.</p><li>
336     <a href="../../reference/types/basic_result/has_exception.html" ><code>bool has_exception() const noexcept</code></a>
337 <p>Always returns false for <code>basic_result</code>. Constexpr, never throws.</p><li>
338     <a href="../../reference/types/basic_result/has_failure.html" ><code>bool has_failure() const noexcept</code></a>
339 <p>Returns true if there is either an error or an exception. Constexpr, never throws.</p><li>
340     <a href="../../reference/types/basic_result/has_lost_consistency.html" ><code>bool has_lost_consistency() const noexcept</code></a>
341 <p>Returns true if a preceding swap involving this object failed to preserve the strong guarantee. Constexpr, never throws.</p><li>
342     <a href="../../reference/types/basic_result/assume_value_lvalue.html" ><code>value_type &amp;assume_value() &amp; noexcept</code></a>
343 <p>Narrow contract lvalue reference observer of any value present. Constexpr propagating, never throws.</p><li>
344     <a href="../../reference/types/basic_result/assume_value_lvalue_const.html" ><code>const value_type &amp;assume_value() const &amp; noexcept</code></a>
345 <p>Narrow contract const lvalue reference observer of any value present. Constexpr propagating, never throws.</p><li>
346     <a href="../../reference/types/basic_result/assume_value_rvalue.html" ><code>value_type &amp;&amp;assume_value() &amp;&amp; noexcept</code></a>
347 <p>Narrow contract rvalue reference observer of any value present. Constexpr propagating, never throws.</p><li>
348     <a href="../../reference/types/basic_result/assume_value_rvalue_const.html" ><code>const value_type &amp;&amp;assume_value() const &amp;&amp; noexcept</code></a>
349 <p>Narrow contract const rvalue reference observer of any value present. Constexpr propagating, never throws.</p><li>
350     <a href="../../reference/types/basic_result/value_lvalue.html" ><code>value_type &amp;value() &amp;</code></a>
351 <p>Wide contract lvalue reference observer of any value present. Constexpr propagating.</p><li>
352     <a href="../../reference/types/basic_result/value_lvalue_const.html" ><code>const value_type &amp;value() const &amp;</code></a>
353 <p>Wide contract const lvalue reference observer of any value present. Constexpr propagating.</p><li>
354     <a href="../../reference/types/basic_result/value_rvalue.html" ><code>value_type &amp;&amp;value() &amp;&amp;</code></a>
355 <p>Wide contract rvalue reference observer of any value present. Constexpr propagating.</p><li>
356     <a href="../../reference/types/basic_result/value_rvalue_const.html" ><code>const value_type &amp;&amp;value() const &amp;&amp;</code></a>
357 <p>Wide contract const rvalue reference observer of any value present. Constexpr propagating.</p><li>
358     <a href="../../reference/types/basic_result/assume_error_lvalue.html" ><code>error_type &amp;assume_error() &amp; noexcept</code></a>
359 <p>Narrow contract lvalue reference observer of the stored error. Constexpr propagating, never throws.</p><li>
360     <a href="../../reference/types/basic_result/assume_error_lvalue_const.html" ><code>const error_type &amp;assume_error() const &amp; noexcept</code></a>
361 <p>Narrow contract const lvalue reference observer of the stored error. Constexpr propagating, never throws.</p><li>
362     <a href="../../reference/types/basic_result/assume_error_rvalue.html" ><code>error_type &amp;&amp;assume_error() &amp;&amp; noexcept</code></a>
363 <p>Narrow contract rvalue reference observer of the stored error. Constexpr propagating, never throws.</p><li>
364     <a href="../../reference/types/basic_result/assume_error_rvalue_const.html" ><code>const error_type &amp;&amp;assume_error() const &amp;&amp; noexcept</code></a>
365 <p>Narrow contract const rvalue reference observer of the stored error. Constexpr propagating, never throws.</p><li>
366     <a href="../../reference/types/basic_result/error_lvalue.html" ><code>error_type &amp;error() &amp;</code></a>
367 <p>Wide contract lvalue reference observer of the stored error. Constexpr propagating.</p><li>
368     <a href="../../reference/types/basic_result/error_lvalue_const.html" ><code>const error_type &amp;error() const &amp;</code></a>
369 <p>Wide contract const lvalue reference observer of the stored error. Constexpr propagating.</p><li>
370     <a href="../../reference/types/basic_result/error_rvalue.html" ><code>error_type &amp;&amp;error() &amp;&amp;</code></a>
371 <p>Wide contract rvalue reference observer of the stored error. Constexpr propagating.</p><li>
372     <a href="../../reference/types/basic_result/error_rvalue_const.html" ><code>const error_type &amp;&amp;error() const &amp;&amp;</code></a>
373 <p>Wide contract const rvalue reference observer of the stored error. Constexpr propagating.</p><li>
374     <a href="../../reference/types/basic_result/as_failure_lvalue.html" ><code>auto as_failure() const &amp;</code></a>
375 <p>Return the output from free function <code>failure()</code> containing a copy of any errored state.</p></li></ol>
376
377 <h4 id="modifiers">Modifiers</h4>
378
379 <ol class="children children-li"><li>
380     <a href="../../reference/types/basic_result/swap.html" ><code>void swap(basic_result &amp;)</code></a>
381 <p>Swap one basic_result with another, with the strong guarantee. Noexcept propagating.</p><li>
382     <a href="../../reference/types/basic_result/as_failure_rvalue.html" ><code>auto as_failure() &amp;&amp;</code></a>
383 <p>Return the output from free function <code>failure()</code> containing a move of any errored state.</p></li></ol>
384
385 <h4 id="comparisons">Comparisons</h4>
386
387 <p>See above for why <code>LessThanComparable</code> is not implemented.</p>
388
389 <ol class="children children-li"><li>
390     <a href="../../reference/types/basic_result/equality_basic_result.html" ><code>bool operator==(const basic_result&lt;A, B, C&gt; &amp;) const</code></a>
391 <p>Returns true if this result compares equal to the other result. Constexpr and noexcept propagating.</p><li>
392     <a href="../../reference/types/basic_result/inequality_success_type.html" ><code>bool operator==(const success_type&lt;A&gt; &amp;) const</code></a>
393 <p>Returns true if this result compares equal to the success type sugar. Constexpr and noexcept propagating.</p><li>
394     <a href="../../reference/types/basic_result/equality_failure_type.html" ><code>bool operator==(const failure_type&lt;A, void&gt; &amp;) const</code></a>
395 <p>Returns true if this result compares equal to the failure type sugar. Constexpr and noexcept propagating.</p><li>
396     <a href="../../reference/types/basic_result/inequality_basic_result.html" ><code>bool operator!=(const basic_result&lt;A, B, C&gt; &amp;) const</code></a>
397 <p>Returns true if this result does not compare equal to the other result. Constexpr and noexcept propagating.</p><li>
398     <a href="../../reference/types/basic_result/equality_success_type.html" ><code>bool operator!=(const success_type&lt;A&gt; &amp;) const</code></a>
399 <p>Returns true if this result does not compare equal to the success type sugar. Constexpr and noexcept propagating.</p><li>
400     <a href="../../reference/types/basic_result/inequality_failure_type.html" ><code>bool operator!=(const failure_type&lt;A, void&gt; &amp;) const</code></a>
401 <p>Returns true if this result does not compare equal to the failure type sugar. Constexpr and noexcept propagating.</p></li></ol>
402
403
404
405
406
407
408
409         </div><p><small>Last revised: October 11, 2019 at 17:03:05 &#43;0100</small></p>
410 <hr>
411 <div class="spirit-nav">
412 <a accesskey="p" href="../../reference/types/basic_outcome/as_failure_rvalue.html"><img src="../../images/prev.png" alt="Prev"></a>
413     <a accesskey="u" href="../../reference/types.html"><img src="../../images/up.png" alt="Up"></a>
414     <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/types/basic_result/default.html"><img src="../../images/next.png" alt="Next"></a></div></body>
415 </html>