failure_type.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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>failure_type&lt;EC, EP = void&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. <link rel="icon" href="../../images/favicon.ico" type="image/ico"/>
  8. <body><div class="spirit-nav">
  9. <a accesskey="p" href="../../reference/types/bad_result_access.html"><img src="../../images/prev.png" alt="Prev"></a>
  10. <a accesskey="u" href="../../reference/types.html"><img src="../../images/up.png" alt="Up"></a>
  11. <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/types/in_place_type_t.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content">
  12. <div class="titlepage"><div><div><h1 style="clear: both"><code>failure_type&lt;EC, EP = void&gt;</code></h1></div></div></div>
  13. <p>Type sugar for constructing an unsuccessful result or outcome. Generally not constructed directly, but via the free function <a href="../../reference/functions/failure.html" class="api-reference"><code>failure(T &amp;&amp;, ...)</code></a>
  14. . Detectable using <a href="../../reference/traits/is_failure_type.html" class="api-reference"><code>is_failure_type&lt;T&gt;</code></a>
  15. .</p>
  16. <p>This is a regular wrapper type, with defaulted default, copy and move constructor, defaulted assignment, and defaulted destructor.</p>
  17. <p>Member type aliases <code>error_type</code> and <code>exception_type</code> indicate <code>EC</code> and <code>E</code>.</p>
  18. <p>There is an explicit initialising constructor taking any types <code>U</code> and <code>V</code> which will forward construct the contained <code>error_type</code> and <code>exception_type</code> respectively.</p>
  19. <p>There are two tagged initialising constructors taking <code>in_place_type_t&lt;error_type&gt;</code> or <code>in_place_type_t&lt;exception_type&gt;</code>, and a <code>U</code> which will forward construct the contained <code>error_type</code> and <code>exception_type</code> respectively.</p>
  20. <p>There are <code>.error()</code> and <code>.exception()</code> reference observers with the usual constexpr lvalue, const lvalue, rvalue and const rvalue overloads. One can discover which or both of these is valid using the usual <code>.has_error()</code> and <code>.has_exception()</code> observers.</p>
  21. <p>There are specialisations <code>failure_type&lt;EC, void&gt;</code> and <code>failure_type&lt;void, E&gt;</code> which store nothing for the voided type and do not provide their observer functions.</p>
  22. <p><em>Requires</em>: Nothing.</p>
  23. <p><em>Namespace</em>: <code>BOOST_OUTCOME_V2_NAMESPACE</code></p>
  24. <p><em>Header</em>: <code>&lt;boost/outcome/success_failure.hpp&gt;</code></p>
  25. </div><p><small>Last revised: January 24, 2019 at 01:15:16 UTC</small></p>
  26. <hr>
  27. <div class="spirit-nav">
  28. <a accesskey="p" href="../../reference/types/bad_result_access.html"><img src="../../images/prev.png" alt="Prev"></a>
  29. <a accesskey="u" href="../../reference/types.html"><img src="../../images/up.png" alt="Up"></a>
  30. <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/types/in_place_type_t.html"><img src="../../images/next.png" alt="Next"></a></div></body>
  31. </html>