Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::Expected< void, E > Class Template Reference

Success, or an error of type E, as std::expected<void, E>. More...

#include <expected.h>

Public Types

using value_type = void
 There is no value.
using error_type = E
 The error's type.

Public Member Functions

 Expected ()=default
 Success.
template<typename G>
 Expected (const Unexpected< G > &error)
 Holds error's error.
template<typename G>
 Expected (Unexpected< G > &&error)
 Holds error's error.
bool has_value () const noexcept
 Whether it succeeded.
 operator bool () const noexcept
 Whether it succeeded.
void value () const
 Nothing; stops the program if it holds an error.
void operator* () const noexcept
 Nothing; it must have succeeded.
const E & error () const &
 The error; it must hold one (stops the program if it succeeded).
E & error () &
 The error; it must hold one (stops the program if it succeeded).
E && error () &&
 The error, moved out; it must hold one (stops the program if it succeeded).
const void * operator-> () const
 The value's members; it must hold one.
void value_or (U &&fallback) const &
 The value, or fallback if it holds an error.

Private Member Functions

void check () const
 Stops the program if it holds an error.
const void * valuePointer () const
 The value, asserting that there is one.

Static Private Member Functions

static QString messageOf (const G &error)
 The message of an Error, for badExpectedAccess(); other error types have none.

Private Attributes

std::optional< E > m_error
 The error, if it failed.
std::variant< void, E > m_v
 The value (index 0) or the error (index 1).

Detailed Description

template<typename E>
class Sonde::Expected< void, E >

Success, or an error of type E, as std::expected<void, E>.


The documentation for this class was generated from the following file: