valueornone.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536
  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>ValueOrNone&lt;T&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/concepts/valueorerror.html"><img src="../../images/prev.png" alt="Prev"></a>
  10. <a accesskey="u" href="../../reference/concepts.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/converters.html"><img src="../../images/next.png" alt="Next"></a></div><div id="content">
  12. <div class="titlepage"><div><div><h1 style="clear: both"><code>ValueOrNone&lt;T&gt;</code></h1></div></div></div>
  13. <p>If on C++ 20 or the Concepts TS is enabled, a boolean concept matching types with a public <code>.has_value()</code> observer which returns <code>bool</code>, and a public <code>.value()</code> observer function.</p>
  14. <p>If without Concepts, a static constexpr bool which is true for types matching the same requirements, using a SFINAE based emulation.</p>
  15. <p>This concept matches optional-like types such as
  16. <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>
  17. . Note it also matches
  18. <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>
  19. , which also has an optional-like interface. You may thus wish to preferentially match <a href="../../reference/concepts/valueorerror.html" class="api-reference"><code>ValueOrError&lt;T, E&gt;</code></a>
  20. for any given <code>T</code>.</p>
  21. <p><em>Namespace</em>: <code>BOOST_OUTCOME_V2_NAMESPACE::convert</code></p>
  22. <p><em>Header</em>: <code>&lt;boost/outcome/convert.hpp&gt;</code></p>
  23. </div><p><small>Last revised: December 13, 2018 at 17:36:11 UTC</small></p>
  24. <hr>
  25. <div class="spirit-nav">
  26. <a accesskey="p" href="../../reference/concepts/valueorerror.html"><img src="../../images/prev.png" alt="Prev"></a>
  27. <a accesskey="u" href="../../reference/concepts.html"><img src="../../images/up.png" alt="Up"></a>
  28. <a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../../reference/converters.html"><img src="../../images/next.png" alt="Next"></a></div></body>
  29. </html>