Skip to content

Instantly share code, notes, and snippets.

@ned14
Created January 15, 2018 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ned14/b16915d8ec2b480a16273a3891ebc9a0 to your computer and use it in GitHub Desktop.
Save ned14/b16915d8ec2b480a16273a3891ebc9a0 to your computer and use it in GitHub Desktop.

+++ title = "result<R, S>" weight = 20 +++

Header file result.hpp

namespace outcome_v2_xxx
{
namespace policy
{
template <class T, class EC, class E>
using default_policy = std::conditional_t<std::is_void<EC>::value && std::is_void<E>::value, terminate, std::conditional_t<trait::has_error_code_v<EC>, error_code_throw_as_system_error<T, EC, E>, std::conditional_t<trait::has_exception_ptr_v<EC> || trait::has_exception_ptr_v<E>, exception_ptr_rethrow<T, EC, E>, all_narrow> >>;
}

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">using</span> <a href="#standardese-outcome_v2_xxx::is_result%3CT%3E"><span class="typ dec var fun">is_result</span></a> <span class="pun">=</span> <span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">;</span>

<span class="typ dec var fun">template</span> <span class="pun">&lt;</span><span class="typ dec var fun">class</span> <span class="kwd">T</span><span class="pun">&gt;</span><span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">is_result_v</span> <span class="pun">=</span> <span class="kwd">detail</span><span class="pun">::</span><span class="kwd">is_result</span><span class="pun">&lt;</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">decay_t</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">&gt;&gt;</span><span class="pun">::</span><span class="kwd">value</span><span class="pun">;</span>

<span class="kwd">namespace</span> <a href="standardese_entities.md#standardese-outcome_v2_xxx::hooks"><span class="typ dec var fun">hooks</span></a>
<span class="pun">{</span>
    <span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">&gt;</span>
    <span class="kwd">constexpr</span> <span class="kwd">void</span> <a href="#standardese-outcome_v2_xxx::hooks::hook_result_construction%3CT,U%3E(T*,U&amp;&amp;)"><span class="typ dec var fun">hook_result_construction</span></a><span class="pun">(</span><span class="typ dec var fun">T</span><span class="pun">*</span><span class="pun">,</span> <span class="typ dec var fun">U</span><span class="pun">&amp;&amp;</span><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">;</span>

    <span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">&gt;</span>
    <span class="kwd">constexpr</span> <span class="kwd">void</span> <a href="#standardese-outcome_v2_xxx::hooks::hook_result_copy_construction%3CT,U%3E(T*,U&amp;&amp;)"><span class="typ dec var fun">hook_result_copy_construction</span></a><span class="pun">(</span><span class="typ dec var fun">T</span><span class="pun">*</span><span class="pun">,</span> <span class="typ dec var fun">U</span><span class="pun">&amp;&amp;</span><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">;</span>

    <span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">&gt;</span>
    <span class="kwd">constexpr</span> <span class="kwd">void</span> <a href="#standardese-outcome_v2_xxx::hooks::hook_result_move_construction%3CT,U%3E(T*,U&amp;&amp;)"><span class="typ dec var fun">hook_result_move_construction</span></a><span class="pun">(</span><span class="typ dec var fun">T</span><span class="pun">*</span><span class="pun">,</span> <span class="typ dec var fun">U</span><span class="pun">&amp;&amp;</span><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">;</span>

    <span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">,</span> <span class="kwd">class</span> <span class="pun">...</span> <span class="typ dec var fun">Args</span><span class="pun">&gt;</span>
    <span class="kwd">constexpr</span> <span class="kwd">void</span> <a href="#standardese-outcome_v2_xxx::hooks::hook_result_in_place_construction%3CT,U,Args%3E(T*,in_place_type_t%3CU%3E,Args&amp;&amp;...)"><span class="typ dec var fun">hook_result_in_place_construction</span></a><span class="pun">(</span><span class="typ dec var fun">T</span><span class="pun">*</span><span class="pun">,</span> <a href="doc_value_storage.md#standardese-outcome_v2_xxx::in_place_type_t%3CT%3E"><span class="typ dec var fun">in_place_type_t</span></a><span class="pun">&lt;</span>U<span class="pun">&gt;</span><span class="pun">,</span> Args &amp;&amp;...<span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">;</span>

    <span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">R</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">S</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">NoValuePolicy</span><span class="pun">&gt;</span>
    <span class="kwd">constexpr</span> <span class="typ dec var fun">uint16_t</span> <a href="#standardese-outcome_v2_xxx::hooks::spare_storage%3CR,S,NoValuePolicy%3E(detail::result_final%3CR,S,NoValuePolicy%3Econst*)"><span class="typ dec var fun">spare_storage</span></a><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span> <span class="kwd">const</span><span class="pun">*</span> <span class="typ dec var fun">r</span><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">;</span>

    <span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">R</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">S</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">NoValuePolicy</span><span class="pun">&gt;</span>
    <span class="kwd">constexpr</span> <span class="kwd">void</span> <a href="#standardese-outcome_v2_xxx::hooks::set_spare_storage%3CR,S,NoValuePolicy%3E(detail::result_final%3CR,S,NoValuePolicy%3E*,uint16_t)"><span class="typ dec var fun">set_spare_storage</span></a><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">*</span> <span class="typ dec var fun">r</span><span class="pun">,</span> <span class="typ dec var fun">uint16_t</span> <span class="typ dec var fun">v</span><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">;</span>
<span class="pun">}</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E.R"><span class="typ dec var fun">R</span></a><span class="pun">,</span> <span class="kwd">class</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E.S"><span class="typ dec var fun">S</span></a><span class="pun">,</span> <span class="kwd">class</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E.NoValuePolicy"><span class="typ dec var fun">NoValuePolicy</span></a><span class="pun">&gt;</span>
<span class="kwd">class</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E"><span class="typ dec var fun">result</span></a><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">R</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">S</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">P</span><span class="pun">&gt;</span>
<span class="kwd">void</span> <a href="#standardese-outcome_v2_xxx::swap%3CR,S,P%3E(result%3CR,S,P%3E&amp;,result%3CR,S,P%3E&amp;)"><span class="typ dec var fun">swap</span></a><span class="pun">(</span><a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E"><span class="typ dec var fun">result</span></a><span class="pun">&lt;</span>R, S, P<span class="pun">&gt;</span><span class="pun">&amp;</span> <span class="typ dec var fun">a</span><span class="pun">,</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E"><span class="typ dec var fun">result</span></a><span class="pun">&lt;</span>R, S, P<span class="pun">&gt;</span><span class="pun">&amp;</span> <span class="typ dec var fun">b</span><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">is_result_v</span> <span class="pun">=</span> <span class="kwd">detail</span><span class="pun">::</span><span class="kwd">is_result</span><span class="pun">&lt;</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">decay_t</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">&gt;&gt;</span><span class="pun">::</span><span class="kwd">value</span><span class="pun">;</span>

<span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">is_result_v</span> <span class="pun">=</span> <span class="kwd">detail</span><span class="pun">::</span><span class="kwd">is_result</span><span class="pun">&lt;</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">decay_t</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">&gt;&gt;</span><span class="pun">::</span><span class="kwd">value</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">R</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">S</span> <span class="pun">=</span> std::error_code<span class="pun">&gt;</span>
<span class="kwd">using</span> <a href="#standardese-outcome_v2_xxx::unchecked%3CR,S%3E"><span class="typ dec var fun">unchecked</span></a> <span class="pun">=</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E"><span class="typ dec var fun">result</span></a><span class="pun">&lt;</span>R, S, policy::all_narrow<span class="pun">&gt;</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">R</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">S</span> <span class="pun">=</span> std::error_code<span class="pun">&gt;</span>
<span class="kwd">using</span> <a href="#standardese-outcome_v2_xxx::checked%3CR,S%3E"><span class="typ dec var fun">checked</span></a> <span class="pun">=</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E"><span class="typ dec var fun">result</span></a><span class="pun">&lt;</span>R, S, policy::throw_bad_result_access&lt;S&gt;<span class="pun">&gt;</span><span class="pun">;</span>

}

Alias template outcome_v2_xxx::policy::default_policy

template <class T, class EC, class E>
using default_policy = std::conditional_t<std::is_void<EC>::value && std::is_void<E>::value, terminate, std::conditional_t<trait::has_error_code_v<EC>, error_code_throw_as_system_error<T, EC, E>, std::conditional_t<trait::has_exception_ptr_v<EC> || trait::has_exception_ptr_v<E>, exception_ptr_rethrow<T, EC, E>, all_narrow> >>;

Default policy selector.


Alias template outcome_v2_xxx::is_result

template <class T>
using is_result = 'hidden';

True if a result


Unexposed entity outcome_v2_xxx::is_result_v

template <class T>static constexpr bool is_result_v = detail::is_result<std::decay_t<T>>::value;

True if a result


Function outcome_v2_xxx::hooks::hook_result_construction

template <class T, class U>
constexpr void hook_result_construction(T*, U&&) noexcept;

The default instantiation hook implementation called when a result is first created by conversion from one of its possible types. Does nothing.

WARNING: The compiler is permitted to elide calls to constructors, and thus this hook may not get called when you think it should!

Parameters

  • — Some result<...> being constructed.

Function outcome_v2_xxx::hooks::hook_result_copy_construction

template <class T, class U>
constexpr void hook_result_copy_construction(T*, U&&) noexcept;

The default instantiation hook implementation called when a result is created by copying from another result. Does nothing.

WARNING: The compiler is permitted to elide calls to constructors, and thus this hook may not get called when you think it should!

Parameters

  • — Some result<...> being constructed.

Function outcome_v2_xxx::hooks::hook_result_move_construction

template <class T, class U>
constexpr void hook_result_move_construction(T*, U&&) noexcept;

The default instantiation hook implementation called when a result is created by moving from another result. Does nothing.

WARNING: The compiler is permitted to elide calls to constructors, and thus this hook may not get called when you think it should!

Parameters

  • — Some result<...> being constructed.

Function outcome_v2_xxx::hooks::hook_result_in_place_construction

template <class T, class U, class ... Args>
constexpr void hook_result_in_place_construction(T*, in_place_type_t<U>, Args &&...) noexcept;

The default instantiation hook implementation called when a result is created by in place construction. Does nothing.

WARNING: The compiler is permitted to elide calls to constructors, and thus this hook may not get called when you think it should!

Parameters

  • — Some result<...> being constructed.
  • — The type of in place construction occurring.

Function outcome_v2_xxx::hooks::spare_storage

template <class R, class S, class NoValuePolicy>
constexpr uint16_t spare_storage('hidden' const* r) noexcept;

Retrieves the 16 bits of spare storage in result/outcome.


Function outcome_v2_xxx::hooks::set_spare_storage

template <class R, class S, class NoValuePolicy>
constexpr void set_spare_storage('hidden'* r, uint16_t v) noexcept;

Sets the 16 bits of spare storage in result/outcome.


Class outcome_v2_xxx::result

template <class R, class S, class NoValuePolicy>
class result
{
public:
//=== Member types ===//
using value_type = R;

<span class="kwd">using</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::error_type"><span class="typ dec var fun">error_type</span></a> <span class="pun">=</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E.S"><span class="typ dec var fun">S</span></a><span class="pun">;</span>

<span class="kwd">using</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::value_type_if_enabled"><span class="typ dec var fun">value_type_if_enabled</span></a> <span class="pun">=</span> typename base::_value_type<span class="pun">;</span>

<span class="kwd">using</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::error_type_if_enabled"><span class="typ dec var fun">error_type_if_enabled</span></a> <span class="pun">=</span> typename base::_error_type<span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span> <span class="pun">=</span> S<span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">V</span> <span class="pun">=</span> policy::default_policy&lt;T,U,void&gt;<span class="pun">&gt;</span>
<span class="kwd">using</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::rebind%3CT,U,V%3E"><span class="typ dec var fun">rebind</span></a> <span class="pun">=</span> <span class="typ dec var fun">result</span><span class="pun">&lt;</span>T, U, V<span class="pun">&gt;</span><span class="pun">;</span>

protected: struct predicate;

public: //=== Default, copy/move constructors and assignment ===// result() = delete;

<a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result(result%3CR,S,NoValuePolicy%3E&amp;&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span>result&lt;R, S, NoValuePolicy&gt;<span class="pun">&amp;&amp;</span><span class="pun">)</span> <span class="pun">=</span> <span class="kwd">default</span><span class="pun">;</span>

<a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result(constresult%3CR,S,NoValuePolicy%3E&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span>const result&lt;R, S, NoValuePolicy&gt;<span class="pun">&amp;</span><span class="pun">)</span> <span class="pun">=</span> <span class="kwd">default</span><span class="pun">;</span>

result&lt;R, S, NoValuePolicy&gt;<span class="pun">&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::operator=(result%3CR,S,NoValuePolicy%3E&amp;&amp;)"><span class="typ dec var fun">operator=</span></a><span class="pun">(</span>result&lt;R, S, NoValuePolicy&gt;<span class="pun">&amp;&amp;</span><span class="pun">)</span> <span class="pun">=</span> <span class="kwd">default</span><span class="pun">;</span>

result&lt;R, S, NoValuePolicy&gt;<span class="pun">&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::operator=(constresult%3CR,S,NoValuePolicy%3E&amp;)"><span class="typ dec var fun">operator=</span></a><span class="pun">(</span>const result&lt;R, S, NoValuePolicy&gt;<span class="pun">&amp;</span><span class="pun">)</span> <span class="pun">=</span> <span class="kwd">default</span><span class="pun">;</span>

<span class="typ dec var fun">~result</span><span class="pun">(</span><span class="pun">)</span> <span class="pun">=</span> <span class="kwd">default</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(T&amp;&amp;,outcome_v2_xxx::result::value_converting_constructor_tag)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><span class="typ dec var fun">T</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(T&amp;&amp;,outcome_v2_xxx::result::value_converting_constructor_tag).t"><span class="typ dec var fun">t</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(T&amp;&amp;,outcome_v2_xxx::result::error_converting_constructor_tag)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><span class="typ dec var fun">T</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(T&amp;&amp;,outcome_v2_xxx::result::error_converting_constructor_tag).t"><span class="typ dec var fun">t</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">ErrorCondEnum</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CErrorCondEnum,,%3E(ErrorCondEnum&amp;&amp;,outcome_v2_xxx::result::error_condition_converting_constructor_tag)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><span class="typ dec var fun">ErrorCondEnum</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CErrorCondEnum,,%3E(ErrorCondEnum&amp;&amp;,outcome_v2_xxx::result::error_condition_converting_constructor_tag).t"><span class="typ dec var fun">t</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,,%3E(T&amp;&amp;,outcome_v2_xxx::result::explicit_valueorerror_converting_constructor_tag)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><span class="typ dec var fun">T</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,,%3E(T&amp;&amp;,outcome_v2_xxx::result::explicit_valueorerror_converting_constructor_tag).o"><span class="typ dec var fun">o</span></a><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">V</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,U,V,%3E(result%3CT,U,V%3Econst&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><span class="typ dec var fun">result</span><span class="pun">&lt;</span>T, U, V<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,U,V,%3E(result%3CT,U,V%3Econst&amp;).o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">V</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,U,V,%3E(result%3CT,U,V%3E&amp;&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><span class="typ dec var fun">result</span><span class="pun">&lt;</span>T, U, V<span class="pun">&gt;</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,U,V,%3E(result%3CT,U,V%3E&amp;&amp;).o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="pun">...</span> <span class="typ dec var fun">Args</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CArgs,%3E(in_place_type_t%3Coutcome_v2_xxx::result::value_type_if_enabled%3E,Args&amp;&amp;...)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="doc_value_storage.md#standardese-outcome_v2_xxx::in_place_type_t%3CT%3E"><span class="typ dec var fun">in_place_type_t</span></a><span class="pun">&lt;</span>outcome_v2_xxx::result::value_type_if_enabled<span class="pun">&gt;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CArgs,%3E(in_place_type_t%3Coutcome_v2_xxx::result::value_type_if_enabled%3E,Args&amp;&amp;...)._"><span class="typ dec var fun">_</span></a><span class="pun">,</span> Args &amp;&amp;... <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CArgs,%3E(in_place_type_t%3Coutcome_v2_xxx::result::value_type_if_enabled%3E,Args&amp;&amp;...).args"><span class="typ dec var fun">args</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">,</span> <span class="kwd">class</span> <span class="pun">...</span> <span class="typ dec var fun">Args</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CU,Args,%3E(in_place_type_t%3Coutcome_v2_xxx::result::value_type_if_enabled%3E,std::initializer_list%3CU%3E,Args&amp;&amp;...)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="doc_value_storage.md#standardese-outcome_v2_xxx::in_place_type_t%3CT%3E"><span class="typ dec var fun">in_place_type_t</span></a><span class="pun">&lt;</span>outcome_v2_xxx::result::value_type_if_enabled<span class="pun">&gt;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CU,Args,%3E(in_place_type_t%3Coutcome_v2_xxx::result::value_type_if_enabled%3E,std::initializer_list%3CU%3E,Args&amp;&amp;...)._"><span class="typ dec var fun">_</span></a><span class="pun">,</span> <span class="typ dec var fun">std::initializer_list</span><span class="pun">&lt;</span>U<span class="pun">&gt;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CU,Args,%3E(in_place_type_t%3Coutcome_v2_xxx::result::value_type_if_enabled%3E,std::initializer_list%3CU%3E,Args&amp;&amp;...).il"><span class="typ dec var fun">il</span></a><span class="pun">,</span> Args &amp;&amp;... <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CU,Args,%3E(in_place_type_t%3Coutcome_v2_xxx::result::value_type_if_enabled%3E,std::initializer_list%3CU%3E,Args&amp;&amp;...).args"><span class="typ dec var fun">args</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="pun">...</span> <span class="typ dec var fun">Args</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CArgs,%3E(in_place_type_t%3Coutcome_v2_xxx::result::error_type_if_enabled%3E,Args&amp;&amp;...)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="doc_value_storage.md#standardese-outcome_v2_xxx::in_place_type_t%3CT%3E"><span class="typ dec var fun">in_place_type_t</span></a><span class="pun">&lt;</span>outcome_v2_xxx::result::error_type_if_enabled<span class="pun">&gt;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CArgs,%3E(in_place_type_t%3Coutcome_v2_xxx::result::error_type_if_enabled%3E,Args&amp;&amp;...)._"><span class="typ dec var fun">_</span></a><span class="pun">,</span> Args &amp;&amp;... <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CArgs,%3E(in_place_type_t%3Coutcome_v2_xxx::result::error_type_if_enabled%3E,Args&amp;&amp;...).args"><span class="typ dec var fun">args</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">,</span> <span class="kwd">class</span> <span class="pun">...</span> <span class="typ dec var fun">Args</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CU,Args,%3E(in_place_type_t%3Coutcome_v2_xxx::result::error_type_if_enabled%3E,std::initializer_list%3CU%3E,Args&amp;&amp;...)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="doc_value_storage.md#standardese-outcome_v2_xxx::in_place_type_t%3CT%3E"><span class="typ dec var fun">in_place_type_t</span></a><span class="pun">&lt;</span>outcome_v2_xxx::result::error_type_if_enabled<span class="pun">&gt;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CU,Args,%3E(in_place_type_t%3Coutcome_v2_xxx::result::error_type_if_enabled%3E,std::initializer_list%3CU%3E,Args&amp;&amp;...)._"><span class="typ dec var fun">_</span></a><span class="pun">,</span> <span class="typ dec var fun">std::initializer_list</span><span class="pun">&lt;</span>U<span class="pun">&gt;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CU,Args,%3E(in_place_type_t%3Coutcome_v2_xxx::result::error_type_if_enabled%3E,std::initializer_list%3CU%3E,Args&amp;&amp;...).il"><span class="typ dec var fun">il</span></a><span class="pun">,</span> Args &amp;&amp;... <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CU,Args,%3E(in_place_type_t%3Coutcome_v2_xxx::result::error_type_if_enabled%3E,std::initializer_list%3CU%3E,Args&amp;&amp;...).args"><span class="typ dec var fun">args</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">A1</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">A2</span><span class="pun">,</span> <span class="kwd">class</span> <span class="pun">...</span> <span class="typ dec var fun">Args</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CA1,A2,Args,%3E(A1&amp;&amp;,A2&amp;&amp;,Args&amp;&amp;...)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><span class="typ dec var fun">A1</span><span class="pun">&amp;&amp;</span> <span class="typ dec var fun">a1</span><span class="pun">,</span> <span class="typ dec var fun">A2</span><span class="pun">&amp;&amp;</span> <span class="typ dec var fun">a2</span><span class="pun">,</span> Args &amp;&amp;... <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CA1,A2,Args,%3E(A1&amp;&amp;,A2&amp;&amp;,Args&amp;&amp;...).args"><span class="typ dec var fun">args</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result(success_type%3Cvoid%3Econst&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::success_type%3CT%3E"><span class="typ dec var fun">success_type</span></a><span class="pun">&lt;</span>void<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result(success_type%3Cvoid%3Econst&amp;).o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(success_type%3CT%3Econst&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::success_type%3CT%3E"><span class="typ dec var fun">success_type</span></a><span class="pun">&lt;</span>T<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(success_type%3CT%3Econst&amp;).o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(success_type%3CT%3E&amp;&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::success_type%3CT%3E"><span class="typ dec var fun">success_type</span></a><span class="pun">&lt;</span>T<span class="pun">&gt;</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(success_type%3CT%3E&amp;&amp;).o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(failure_type%3CT%3Econst&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::failure_type%3CEC,E%3E"><span class="typ dec var fun">failure_type</span></a><span class="pun">&lt;</span>T<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(failure_type%3CT%3Econst&amp;).o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(failure_type%3CT%3E&amp;&amp;)"><span class="typ dec var fun">result</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::failure_type%3CEC,E%3E"><span class="typ dec var fun">failure_type</span></a><span class="pun">&lt;</span>T<span class="pun">&gt;</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::result%3CT,%3E(failure_type%3CT%3E&amp;&amp;).o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">void</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::swap(result%3CR,S,NoValuePolicy%3E&amp;)"><span class="typ dec var fun">swap</span></a><span class="pun">(</span>result&lt;R, S, NoValuePolicy&gt;<span class="pun">&amp;</span> <span class="typ dec var fun">o</span><span class="pun">)</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">auto</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::as_failure()const&amp;"><span class="typ dec var fun">as_failure</span></a><span class="pun">(</span><span class="pun">)</span> <span class="kwd">const</span> <span class="pun">&amp;</span><span class="pun">;</span>

<span class="kwd">auto</span> <a href="#standardese-outcome_v2_xxx::result%3CR,S,NoValuePolicy%3E::as_failure()&amp;&amp;"><span class="typ dec var fun">as_failure</span></a><span class="pun">(</span><span class="pun">)</span> <span class="pun">&amp;&amp;</span><span class="pun">;</span>

<span class="kwd">using</span> <span class="typ dec var fun">error_type</span> <span class="pun">=</span> <span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">;</span>

&#x2F;&#x2F;=== assume_error ===&#x2F;&#x2F;
<span class="kwd">constexpr</span> <span class="typ dec var fun">error_type</span><span class="pun">&amp;</span> <a href="#standardese-outcome_v2_xxx::detail::result_error_observers%3CBase,EC,NoValuePolicy%3E::assume_error()&amp;"><span class="typ dec var fun">assume_error</span></a><span class="pun">(</span><span class="pun">)</span> <span class="pun">&amp;</span> <span class="kwd">noexcept</span><span class="pun">;</span>
<span class="kwd">constexpr</span> <span class="typ dec var fun">error_type</span><span class="pun">&amp;</span> <a href="#standardese-outcome_v2_xxx::detail::result_error_observers%3CBase,EC,NoValuePolicy%3E::assume_error()&amp;"><span class="typ dec var fun">assume_error</span></a><span class="pun">(</span><span class="pun">)</span> <span class="kwd">const</span> <span class="pun">&amp;</span> <span class="kwd">noexcept</span><span class="pun">;</span>
<span class="kwd">constexpr</span> <span class="typ dec var fun">error_type</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::detail::result_error_observers%3CBase,EC,NoValuePolicy%3E::assume_error()&amp;"><span class="typ dec var fun">assume_error</span></a><span class="pun">(</span><span class="pun">)</span> <span class="pun">&amp;&amp;</span> <span class="kwd">noexcept</span><span class="pun">;</span>
<span class="kwd">constexpr</span> <span class="typ dec var fun">error_type</span><span class="pun">&amp;&amp;</span> <a href="#standardese-outcome_v2_xxx::detail::result_error_observers%3CBase,EC,NoValuePolicy%3E::assume_error()&amp;"><span class="typ dec var fun">assume_error</span></a><span class="pun">(</span><span class="pun">)</span> <span class="kwd">const</span> <span class="pun">&amp;&amp;</span> <span class="kwd">noexcept</span><span class="pun">;</span>

<span class="kwd">explicit</span> <span class="kwd">operator</span> <span class="kwd">bool</span><span class="pun">(</span><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">;</span>

<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::has_value()const"><span class="typ dec var fun">has_value</span></a><span class="pun">(</span><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">;</span>

<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::has_error()const"><span class="typ dec var fun">has_error</span></a><span class="pun">(</span><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">;</span>

<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::has_exception()const"><span class="typ dec var fun">has_exception</span></a><span class="pun">(</span><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">;</span>

<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::has_failure()const"><span class="typ dec var fun">has_failure</span></a><span class="pun">(</span><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">V</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator==%3CT,U,V%3E(result_final%3CT,U,V%3Econst&amp;)const"><span class="typ dec var fun">operator==</span></a><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="doc_result_final.md#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator==%3CT,U,V%3E(result_final%3CT,U,V%3Econst&amp;)const.o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator==%3CT%3E(success_type%3CT%3Econst&amp;)const"><span class="typ dec var fun">operator==</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::success_type%3CT%3E"><span class="typ dec var fun">success_type</span></a><span class="pun">&lt;</span>T<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="doc_result_final.md#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator==%3CT%3E(success_type%3CT%3Econst&amp;)const.o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator==(success_type%3Cvoid%3Econst&amp;)const"><span class="typ dec var fun">operator==</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::success_type%3CT%3E"><span class="typ dec var fun">success_type</span></a><span class="pun">&lt;</span>void<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="doc_result_final.md#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator==(success_type%3Cvoid%3Econst&amp;)const.o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator==%3CT%3E(failure_type%3CT,void%3Econst&amp;)const"><span class="typ dec var fun">operator==</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::failure_type%3CEC,E%3E"><span class="typ dec var fun">failure_type</span></a><span class="pun">&lt;</span>T, void<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="doc_result_final.md#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator==%3CT%3E(failure_type%3CT,void%3Econst&amp;)const.o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">U</span><span class="pun">,</span> <span class="kwd">class</span> <span class="typ dec var fun">V</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator!=%3CT,U,V%3E(result_final%3CT,U,V%3Econst&amp;)const"><span class="typ dec var fun">operator!=</span></a><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="doc_result_final.md#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator!=%3CT,U,V%3E(result_final%3CT,U,V%3Econst&amp;)const.o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator!=%3CT%3E(success_type%3CT%3Econst&amp;)const"><span class="typ dec var fun">operator!=</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::success_type%3CT%3E"><span class="typ dec var fun">success_type</span></a><span class="pun">&lt;</span>T<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="doc_result_final.md#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator!=%3CT%3E(success_type%3CT%3Econst&amp;)const.o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator!=(success_type%3Cvoid%3Econst&amp;)const"><span class="typ dec var fun">operator!=</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::success_type%3CT%3E"><span class="typ dec var fun">success_type</span></a><span class="pun">&lt;</span>void<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="doc_result_final.md#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator!=(success_type%3Cvoid%3Econst&amp;)const.o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="typ dec var fun">T</span><span class="pun">&gt;</span>
<span class="kwd">constexpr</span> <span class="kwd">bool</span> <a href="#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator!=%3CT%3E(failure_type%3CT,void%3Econst&amp;)const"><span class="typ dec var fun">operator!=</span></a><span class="pun">(</span><a href="success_failure#standardese-outcome_v2_xxx::failure_type%3CEC,E%3E"><span class="typ dec var fun">failure_type</span></a><span class="pun">&lt;</span>T, void<span class="pun">&gt;</span> <span class="kwd">const</span><span class="pun">&amp;</span> <a href="doc_result_final.md#standardese-outcome_v2_xxx::detail::result_final%3CR,S,NoValuePolicy%3E::operator!=%3CT%3E(failure_type%3CT,void%3Econst&amp;)const.o"><span class="typ dec var fun">o</span></a><span class="pun">)</span> <span class="kwd">const</span> <span class="kwd">noexcept</span><span class="pun">(</span><span class="typ dec var fun">&#x27;hidden&#x27;</span><span class="pun">)</span><span class="pun">;</span>

};

Used to return from functions either (i) a successful value (ii) a cause of failure. constexpr capable.

Any R (value_type) state can be observed using the member functions .value() and .assume_value(). Any S (error_type) state can be observed using the member functions .error() and .assume_error().

NoValuePolicy defaults to a policy selected according to the characteristics of type S:

  1. If .value() called when there is no value_type but there is an error_type:
  • If trait::has_error_code_v<S> is true, then throw std::system_error(error()|make_error_code(error())) [{{<api "policies/result_error_code_throw_as_system_error" "policy::error_code_throw_as_system_error">}}verbatim]

  • If trait::has_exception_ptr_v<S>, then std::rethrow_exception(error()|make_exception_ptr(error())) [policy::exception_ptr_rethrow<R, S, void>]

  • If S is void, call std::terminate() [policy::terminate]

  • If S is none of the above, then it is undefined behaviour [policy::all_narrow]

  1. If .error() called when there is no error_type:
  • If trait::has_error_code_v<S>, or if trait::has_exception_ptr_v<S>, or if S is void, do throw bad_result_access()

  • If S is none of the above, then it is undefined behaviour [policy::all_narrow]

Template parameters

  • R — The optional type of the successful result (use void to disable). Cannot be a reference, a in_place_type_t<>, success<>, failure<>, an array, a function or non-destructible.
  • S — The optional type of the failure result (use void to disable). Must be either void or DefaultConstructible. Cannot be a reference, a in_place_type_t<>, success<>, failure<>, an array, a function or non-destructible.
  • NoValuePolicy — Policy on how to interpret type S when a wide observation of a not present value occurs.

Function assume_error

(1) constexpr error_type& assume_error() & noexcept;

(2) constexpr error_type& assume_error() const & noexcept;

(3) constexpr error_type&& assume_error() && noexcept;

(4) constexpr error_type&& assume_error() const && noexcept;

Access error without runtime checks.

Preconditions: The result to have a failed state, otherwise it is undefined behaviour.

Returns: Reference to the held error_type according to overload.


Conversion operator operator bool

explicit operator bool() const noexcept;

Checks if has value.

Returns: True if has value.


Function has_value

constexpr bool has_value() const noexcept;

Checks if has value.

Returns: True if has value.


Function has_error

constexpr bool has_error() const noexcept;

Checks if has error.

Returns: True if has error.


Function has_exception

constexpr bool has_exception() const noexcept;

Checks if has exception.

Returns: True if has exception.


Function has_failure

constexpr bool has_failure() const noexcept;

Checks if has error or exception.

Returns: True if has error or exception.


Function operator==

template <class T, class U, class V>
constexpr bool operator==('hidden' const& o) const noexcept('hidden');

True if equal to the other result.

Effects: If a valid expression to do so, calls the operator== operation on each of the two stored items returning true if both are true. Otherwise returns false.

Throws: Any exception the individual operator== operations might throw.

Parameters

  • o — The other result to compare to.

Function operator==

template <class T>
constexpr bool operator==(success_type<T> const& o) const noexcept('hidden');

True if equal to the success type sugar.

Effects: If a valid expression to do so, calls the operator== operation on the successful item returning true if equal. Otherwise returns false.

Throws: Any exception the operator== operation might throw.

Parameters

  • o — The success type sugar to compare to.

Function operator==

constexpr bool operator==(success_type<void> const& o) const noexcept;

True if equal to the success type sugar.

Effects: If a valid expression to do so, calls the operator== operation on the successful item returning true if equal. Otherwise returns false.

Throws: Any exception the operator== operation might throw.

Parameters

  • o — The success type sugar to compare to.

Function operator==

template <class T>
constexpr bool operator==(failure_type<T, void> const& o) const noexcept('hidden');

True if equal to the failure type sugar.

Effects: If a valid expression to do so, calls the operator== operation on the failure item returning true if equal. Otherwise returns false.

Throws: Any exception the operator== operation might throw.

Parameters

  • o — The failure type sugar to compare to.

Function operator!=

template <class T, class U, class V>
constexpr bool operator!=('hidden' const& o) const noexcept('hidden');

True if not equal to the other result.

Effects: If a valid expression to do so, calls the operator!= operation on each of the two stored items, returning true if any are not equal. Otherwise returns true.

Throws: Any exception the individual operator!= operations might throw.

Parameters

  • o — The other result to compare to.

Function operator!=

template <class T>
constexpr bool operator!=(success_type<T> const& o) const noexcept('hidden');

True if not equal to the success type sugar.

Effects: If a valid expression to do so, calls the operator!= operation on the successful item returning true if not equal. Otherwise returns false.

Throws: Any exception the operator!= operation might throw.

Parameters

  • o — The success type sugar to compare to.

Function operator!=

constexpr bool operator!=(success_type<void> const& o) const noexcept;

True if not equal to the success type sugar.

Effects: If a valid expression to do so, calls the operator!= operation on the successful item returning true if not equal. Otherwise returns false.

Throws: Any exception the operator!= operation might throw.

Parameters

  • o — The success type sugar to compare to.

Function operator!=

template <class T>
constexpr bool operator!=(failure_type<T, void> const& o) const noexcept('hidden');

True if not equal to the failure type sugar.

Effects: If a valid expression to do so, calls the operator!= operation on the failure item returning true if not equal. Otherwise returns false.

Throws: Any exception the operator!= operation might throw.

Parameters

  • o — The failure type sugar to compare to.

Type alias value_type

using value_type = R;

The success type.


Type alias error_type

using error_type = S;

The failure type.


Type alias value_type_if_enabled

using value_type_if_enabled = typename base::_value_type;

Used to disable in place type construction when value_type and error_type are ambiguous.


Type alias error_type_if_enabled

using error_type_if_enabled = typename base::_error_type;

Used to disable in place type construction when value_type and error_type are ambiguous.


Alias template rebind

template <class T, class U = S, class V = policy::default_policy<T,U,void>>
using rebind = result<T, U, V>;

Used to rebind this result to a different result type.


Struct predicate

struct predicate
{
using base = 'hidden';

<span class="typ dec var fun">template</span> <span class="pun">&lt;</span><span class="typ dec var fun">class</span> <span class="kwd">T</span><span class="pun">&gt;</span><span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">enable_value_converting_constructor</span> <span class="pun">=</span> <span class="pun">!</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">is_same</span><span class="pun">&lt;</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">decay_t</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">&gt;</span><span class="pun">,</span> <span class="kwd">result</span><span class="pun">&gt;</span><span class="pun">::</span><span class="kwd">value</span> <span class="pun">&amp;&amp;</span> <span class="kwd">base</span><span class="pun">::</span><span class="typ dec var fun">template</span>  <span class="kwd">enable_value_converting_constructor</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">&gt;</span><span class="pun">;</span>

<span class="typ dec var fun">template</span> <span class="pun">&lt;</span><span class="typ dec var fun">class</span> <span class="kwd">T</span><span class="pun">&gt;</span><span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">enable_error_converting_constructor</span> <span class="pun">=</span> <span class="pun">!</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">is_same</span><span class="pun">&lt;</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">decay_t</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">&gt;</span><span class="pun">,</span> <span class="kwd">result</span><span class="pun">&gt;</span><span class="pun">::</span><span class="kwd">value</span> <span class="pun">&amp;&amp;</span> <span class="kwd">base</span><span class="pun">::</span><span class="typ dec var fun">template</span>  <span class="kwd">enable_error_converting_constructor</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">&gt;</span><span class="pun">;</span>

<span class="typ dec var fun">template</span> <span class="pun">&lt;</span><span class="typ dec var fun">class</span> <span class="kwd">ErrorCondEnum</span><span class="pun">&gt;</span><span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">enable_error_condition_converting_constructor</span> <span class="pun">=</span> <span class="pun">!</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">is_same</span><span class="pun">&lt;</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">decay_t</span><span class="pun">&lt;</span><span class="kwd">ErrorCondEnum</span><span class="pun">&gt;</span><span class="pun">,</span> <span class="kwd">result</span><span class="pun">&gt;</span><span class="pun">::</span><span class="kwd">value</span> <span class="pun">&amp;&amp;</span> <span class="kwd">base</span><span class="pun">::</span><span class="typ dec var fun">template</span>  <span class="kwd">enable_error_condition_converting_constructor</span><span class="pun">&lt;</span><span class="kwd">ErrorCondEnum</span><span class="pun">&gt;</span><span class="pun">;</span>

<span class="typ dec var fun">template</span> <span class="pun">&lt;</span><span class="typ dec var fun">class</span> <span class="kwd">T</span><span class="pun">,</span> <span class="typ dec var fun">class</span> <span class="kwd">U</span><span class="pun">,</span> <span class="typ dec var fun">class</span> <span class="kwd">V</span><span class="pun">&gt;</span><span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">enable_compatible_conversion</span> <span class="pun">=</span> <span class="pun">!</span><span class="kwd">std</span><span class="pun">::</span><span class="kwd">is_same</span><span class="pun">&lt;</span><span class="kwd">result</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">,</span> <span class="kwd">U</span><span class="pun">,</span> <span class="kwd">V</span><span class="pun">&gt;</span><span class="pun">,</span> <span class="kwd">result</span><span class="pun">&gt;</span><span class="pun">::</span><span class="kwd">value</span> <span class="pun">&amp;&amp;</span> <span class="kwd">base</span><span class="pun">::</span><span class="typ dec var fun">template</span>  <span class="kwd">enable_compatible_conversion</span><span class="pun">&lt;</span><span class="kwd">T</span><span class="pun">,</span> <span class="kwd">U</span><span class="pun">,</span> <span class="kwd">V</span><span class="pun">&gt;</span><span class="pun">;</span>

<span class="typ dec var fun">template</span> <span class="pun">&lt;</span><span class="typ dec var fun">class</span><span class="pun">...</span><span class="kwd">Args</span><span class="pun">&gt;</span><span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">enable_inplace_value_constructor</span> <span class="pun">=</span> <span class="kwd">std</span><span class="pun">::</span><span class="kwd">is_void</span><span class="pun">&lt;</span><span class="kwd">value_type</span><span class="pun">&gt;</span><span class="pun">::</span><span class="kwd">value</span> <span class="pun">||</span> <span class="kwd">std</span><span class="pun">::</span><span class="kwd">is_constructible</span><span class="pun">&lt;</span><span class="kwd">value_type</span><span class="pun">,</span> <span class="kwd">Args</span><span class="pun">...</span><span class="pun">&gt;</span><span class="pun">::</span><span class="kwd">value</span><span class="pun">;</span>

<span class="typ dec var fun">template</span> <span class="pun">&lt;</span><span class="typ dec var fun">class</span><span class="pun">...</span><span class="kwd">Args</span><span class="pun">&gt;</span><span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">enable_inplace_error_constructor</span> <span class="pun">=</span> <span class="kwd">std</span><span class="pun">::</span><span class="kwd">is_void</span><span class="pun">&lt;</span><span class="kwd">error_type</span><span class="pun">&gt;</span><span class="pun">::</span><span class="kwd">value</span> <span class="pun">||</span> <span class="kwd">std</span><span class="pun">::</span><span class="kwd">is_constructible</span><span class="pun">&lt;</span><span class="kwd">error_type</span><span class="pun">,</span> <span class="kwd">Args</span><span class="pun">...</span><span class="pun">&gt;</span><span class="pun">::</span><span class="kwd">value</span><span class="pun">;</span>

<span class="typ dec var fun">template</span> <span class="pun">&lt;</span><span class="typ dec var fun">class</span><span class="pun">...</span><span class="kwd">Args</span><span class="pun">&gt;</span><span class="typ dec var fun">static</span> <span class="typ dec var fun">constexpr</span> <span class="typ dec var fun">bool</span> <span class="kwd">enable_inplace_value_error_constructor</span> <span class="pun">=</span> <span class="kwd">base</span><span class="pun">::</span><span class="typ dec var fun">template</span>  <span class="kwd">enable_inplace_value_error_constructor</span><span class="pun">&lt;</span><span class="kwd">Args</span><span class="pun">...</span><span class="pun">&gt;</span><span class="pun">;</span>

<span class="kwd">template</span> <span class="pun">&lt;</span><span class="kwd">class</span> <span class="pun">...</span> <span class="typ dec var fun">Args</span><span class="pun">&gt;</span>
<span class="kwd">using</span> <span class="typ dec var fun">choose_inplace_value_error_constructor</span> <span class="pun">=</span> typename base::choose_inplace_value_error_constructor&lt;Args...&gt;<span class="pun">;</span>

};

Requirement predicates for result.

Unexposed entity enable_value_converting_constructor

template <class T>static constexpr bool enable_value_converting_constructor = !std::is_same<std::decay_t<T>, result>::value && base::template  enable_value_converting_constructor<T>;

Predicate for the value converting constructor to be available.


Unexposed entity enable_error_converting_constructor

template <class T>static constexpr bool enable_error_converting_constructor = !std::is_same<std::decay_t<T>, result>::value && base::template  enable_error_converting_constructor<T>;

Predicate for the error converting constructor to be available.


Unexposed entity enable_error_condition_converting_constructor

template <class ErrorCondEnum>static constexpr bool enable_error_condition_converting_constructor = !std::is_same<std::decay_t<ErrorCondEnum>, result>::value && base::template  enable_error_condition_converting_constructor<ErrorCondEnum>;

Predicate for the error condition converting constructor to be available.


Unexposed entity enable_compatible_conversion

template <class T, class U, class V>static constexpr bool enable_compatible_conversion = !std::is_same<result<T, U, V>, result>::value && base::template  enable_compatible_conversion<T, U, V>;

Predicate for the converting copy constructor from a compatible input to be available.


Unexposed entity enable_inplace_value_constructor

template <class...Args>static constexpr bool enable_inplace_value_constructor = std::is_void<value_type>::value || std::is_constructible<value_type, Args...>::value;

Predicate for the inplace construction of value to be available.


Unexposed entity enable_inplace_error_constructor

template <class...Args>static constexpr bool enable_inplace_error_constructor = std::is_void<error_type>::value || std::is_constructible<error_type, Args...>::value;

Predicate for the inplace construction of error to be available.



Constructor result

result() = delete;

Default construction is not permitted.


Constructor result

result(result<R, S, NoValuePolicy>&&) = default;

Move construction available if value_type and error_type implement it.


Constructor result

result(const result<R, S, NoValuePolicy>&) = default;

Copy construction available if value_type and error_type implement it.


Function operator=

result<R, S, NoValuePolicy>& operator=(result<R, S, NoValuePolicy>&&) = default;

Move assignment available if value_type and error_type implement it.


Function operator=

result<R, S, NoValuePolicy>& operator=(const result<R, S, NoValuePolicy>&) = default;

Copy assignment available if value_type and error_type implement it.


Constructor result

template <class T>
constexpr result(T&& t) noexcept('hidden');

Implicit converting constructor to a successful result.

Effects: Initialises the result with a value_type.

Requires: Type T is implicitly constructible to value_type, is not implicitly constructible to error_type, and is not result<R, S> and not in_place_type<>.

Throws: Any exception the construction of value_type(T) might throw.

Parameters

  • t — The value from which to initialise the value_type.

Constructor result

template <class T>
constexpr result(T&& t) noexcept('hidden');

Implicit converting constructor to a failure result.

Effects: Initialises the result with a error_type.

Requires: Type T is implicitly constructible to error_type, is not implicitly constructible to value_type, and is not result<R, S> and not in_place_type<>.

Throws: Any exception the construction of error_type(T) might throw.

Parameters

  • t — The value from which to initialise the error_type.

Constructor result

template <class ErrorCondEnum>
constexpr result(ErrorCondEnum&& t) noexcept('hidden');

Implicit special error condition converting constructor to a failure result.

Effects: Initialises the result with a error_type constructed via make_error_code(t).

Requires: std::is_error_condition_enum<ErrorCondEnum> must be true, ErrorCondEnum is not implicitly constructible to value_type nor error_type, and is not result<R, S> and not in_place_type<>; Finally, the expression error_type(make_error_code(ErrorCondEnum())) must be valid.

Throws: Any exception the construction of error_type(make_error_code(t)) might throw.

Parameters

  • t — The error condition from which to initialise the error_type.

Constructor result

template <class T>
constexpr result(T&& o);

Explicit converting constructor from a compatible ValueOrError type.

Effects: Initialises the result with the contents of the compatible input.

Requires: That convert::value_or_error<result, std::decay_t<T>>{}(std::forward<T>(o)) be available. The default implementation will consume T’s matching the ValueOrError concept type. ValueOrError concept matches any type with a value_type, an error_type, a .value(), an .error() and a .has_value().

Parameters

  • o — The input for which a convert::value_or_error<result, std::decay_t<T>>{}(std::forward<T>(o)) is available.

Constructor result

template <class T, class U, class V>
constexpr result(result<T, U, V> const& o) noexcept('hidden');

Explicit converting copy constructor from a compatible result type.

Effects: Initialises the result with a copy of the compatible result.

Requires: Both result’s value_type and error_type need to be constructible, or the source can be void.

Throws: Any exception the construction of value_type(T) and error_type(U) might throw.

Parameters

  • o — The compatible result.

Constructor result

template <class T, class U, class V>
constexpr result(result<T, U, V>&& o) noexcept('hidden');

Explicit converting move constructor from a compatible result type.

Effects: Initialises the result with a move of the compatible result.

Requires: Both result’s value_type and error_type need to be constructible, or the source can be void.

Throws: Any exception the construction of value_type(T) and error_type(U) might throw.

Parameters

  • o — The compatible result.

Constructor result

template <class ... Args>
constexpr result(in_place_type_t<outcome_v2_xxx::result::value_type_if_enabled> _, Args &&... args) noexcept('hidden');

Explicit inplace constructor to a successful result.

Effects: Initialises the result with a value_type.

Requires: value_type is void or Args... are constructible to value_type.

Throws: Any exception the construction of value_type(Args...) might throw.

Parameters

  • _ — Tag type to indicate we are doing in place construction of value_type.
  • args — Arguments with which to in place construct.

Constructor result

template <class U, class ... Args>
constexpr result(in_place_type_t<outcome_v2_xxx::result::value_type_if_enabled> _, std::initializer_list<U> il, Args &&... args) noexcept('hidden');

Explicit inplace constructor to a successful result.

Effects: Initialises the result with a value_type.

Requires: The initializer list + Args... are constructible to value_type.

Throws: Any exception the construction of value_type(il, Args...) might throw.

Parameters

  • _ — Tag type to indicate we are doing in place construction of value_type.
  • il — An initializer list with which to in place construct.
  • args — Arguments with which to in place construct.

Constructor result

template <class ... Args>
constexpr result(in_place_type_t<outcome_v2_xxx::result::error_type_if_enabled> _, Args &&... args) noexcept('hidden');

Explicit inplace constructor to a failure result.

Effects: Initialises the result with a error_type.

Requires: error_type is void or Args... are constructible to error_type.

Throws: Any exception the construction of error_type(Args...) might throw.

Parameters

  • _ — Tag type to indicate we are doing in place construction of error_type.
  • args — Arguments with which to in place construct.

Constructor result

template <class U, class ... Args>
constexpr result(in_place_type_t<outcome_v2_xxx::result::error_type_if_enabled> _, std::initializer_list<U> il, Args &&... args) noexcept('hidden');

Explicit inplace constructor to a failure result.

Effects: Initialises the result with a error_type.

Requires: The initializer list + Args... are constructible to error_type.

Throws: Any exception the construction of error_type(il, Args...) might throw.

Parameters

  • _ — Tag type to indicate we are doing in place construction of error_type.
  • il — An initializer list with which to in place construct.
  • args — Arguments with which to in place construct.

Constructor result

template <class A1, class A2, class ... Args>
constexpr result(A1&& a1, A2&& a2, Args &&... args) noexcept('hidden');

Implicit inplace constructor to successful or failure result.

Effects: Calls the appropriate in_place_type_t<...> constructor depending on constructibility of args.

Requires: That the args can construct exactly one of value_type or error_type.

Throws: Any exception the in_place_type_t<...> constructor might throw.

Parameters

  • args — Arguments with which to in place construct.

Constructor result

constexpr result(success_type<void> const& o) noexcept('hidden');

Implicit tagged constructor of a successful result.

Effects: Initialises the result with a default constructed success type.

Requires: value_type to be default constructible, or void.

Throws: Any exception the construction of value_type() might throw.

Parameters

  • o — The compatible success type sugar.

Constructor result

template <class T>
constexpr result(success_type<T> const& o) noexcept('hidden');

Implicit tagged constructor of a successful result.

Effects: Initialises the result with a copy of the value in the type sugar.

Requires: Both result and success’ value_type need to be constructible, or the source can be void.

Throws: Any exception the construction of value_type(T) might throw.

Parameters

  • o — The compatible success type sugar.

Constructor result

template <class T>
constexpr result(success_type<T>&& o) noexcept('hidden');

Implicit tagged constructor of a successful result.

Effects: Initialises the result with a move of the value in the type sugar.

Requires: Both result and success’ value_type need to be constructible. The source cannot be void.

Throws: Any exception the construction of value_type(T) might throw.

Parameters

  • o — The compatible success type sugar.

Constructor result

template <class T>
constexpr result(failure_type<T> const& o) noexcept('hidden');

Implicit tagged constructor of a failure result.

Effects: Initialises the result with a copy of the error in the type sugar.

Requires: Both result and failure’s error_type need to be constructible, or the source can be void.

Throws: Any exception the construction of error_type(T) might throw.

Parameters

  • o — The compatible failure type sugar.

Constructor result

template <class T>
constexpr result(failure_type<T>&& o) noexcept('hidden');

Implicit tagged constructor of a failure result.

Effects: Initialises the result with a move of the error in the type sugar.

Requires: Both result and failure’s error_type need to be constructible, or the source can be void.

Throws: Any exception the construction of error_type(T) might throw.

Parameters

  • o — The compatible failure type sugar.

Function swap

void swap(result<R, S, NoValuePolicy>& o) noexcept('hidden');

Swaps this result with another result

Effects: Any R and/or S is swapped along with the metadata tracking them.


Function as_failure

auto as_failure() const &;

Returns this result as a failure_type with any errored state copied.

Requires: This result to have a failed state, else whatever assume_error() would do.


Function as_failure

auto as_failure() &&;

Returns this result as a failure_type with any errored state moved.

Requires: This result to have a failed state, else whatever assume_error() would do.



Function outcome_v2_xxx::swap

template <class R, class S, class P>
void swap(result<R, S, P>& a, result<R, S, P>& b) noexcept('hidden');

Specialise swap for result.

Effects: Calls a.swap(b).


Alias template outcome_v2_xxx::unchecked

template <class R, class S = std::error_code>
using unchecked = result<R, S, policy::all_narrow>;

An “unchecked” edition of result<T, E> which does no special handling of specific E types at all.

Attempting to access T when there is an E results in nothing happening at all, it is treated with a narrow contract (i.e. undefined behaviour).


Alias template outcome_v2_xxx::checked

template <class R, class S = std::error_code>
using checked = result<R, S, policy::throw_bad_result_access<S>>;

A “checked” edition of result<T, E> which does no special handling of specific E types at all.

Attempting to access T when there is an E results in bad_result_access<E> being thrown. Nothing else.

Note that this approximates the proposed expected<T, E> up for standardisation, see the FAQ for more detail.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment