CAF 0.17.6
Loading...
Searching...
No Matches
caf::expected< void > Class Reference

The pattern expected<void> shall be used for functions that may generate an error but would otherwise return bool. More...

#include <expected.hpp>

Public Types

using value_type

Public Member Functions

 expected (unit_t) noexcept
 expected (no_error_t) noexcept
 expected (caf::error e) noexcept
 expected (const expected &other) noexcept
 expected (expected &&other) noexcept
template<class Code, class = enable_if_can_construct_error_t<Code>>
 expected (Code code)
expected & operator= (const expected &other)=default
expected & operator= (expected &&other) noexcept
template<class Code>
enable_if_can_construct_error_t< Code, expected & > operator= (Code code)
 operator bool () const
const caf::errorerror () const
void & value () noexcept
 Returns the contained value.
void & operator* () noexcept
 Returns the contained value.
void * operator-> () noexcept
 Returns the contained value.
const void & cvalue () const noexcept
 Returns the contained value.
bool engaged () const noexcept
 Returns true if the object holds a value (is engaged).
const caf::errorcerror () const noexcept
 Returns the contained error.

Public Attributes

void value_

Static Public Attributes

static constexpr bool nothrow_move
 Stores whether move construct and move assign never throw.
static constexpr bool nothrow_copy
 Stores whether copy construct and copy assign never throw.

(Note that these are not member symbols.)

auto operator== (const expected< void > &x, const expected< void > &y) -> decltype(*x== *y)
auto operator== (const expected< void > &x, const U &y) -> decltype(*x==y)
auto operator== (const void &x, const expected< U > &y) -> decltype(x== *y)
bool operator== (const expected< void > &x, const error &y)
bool operator== (const error &x, const expected< void > &y)
enable_if_has_make_error_t< E, bool > operator== (const expected< void > &x, E y)
enable_if_has_make_error_t< E, bool > operator== (E x, const expected< void > &y)
auto operator!= (const expected< void > &x, const expected< void > &y) -> decltype(*x== *y)
auto operator!= (const expected< void > &x, const U &y) -> decltype(*x==y)
auto operator!= (const void &x, const expected< U > &y) -> decltype(x== *y)
bool operator!= (const expected< void > &x, const error &y)
bool operator!= (const error &x, const expected< void > &y)
enable_if_has_make_error_t< E, bool > operator!= (const expected< void > &x, E y)
enable_if_has_make_error_t< E, bool > operator!= (E x, const expected< void > &y)
bool operator== (const expected< void > &x, const expected< void > &y)
bool operator!= (const expected< void > &x, const expected< void > &y)
constexpr no_error_t no_error
 The only instance of ::no_error_t.

Detailed Description

The pattern expected<void> shall be used for functions that may generate an error but would otherwise return bool.

Member Function Documentation

◆ cerror()

const caf::error & caf::expected< void >::cerror ( ) const
noexcept

Returns the contained error.

Precondition
engaged() == false.

◆ cvalue()

const void & caf::expected< void >::cvalue ( ) const
noexcept

Returns the contained value.

Precondition
engaged() == true.

◆ operator*()

void & caf::expected< void >::operator* ( )
noexcept

Returns the contained value.

Precondition
engaged() == true.

◆ operator->()

void * caf::expected< void >::operator-> ( )
noexcept

Returns the contained value.

Precondition
engaged() == true.

◆ value()

void & caf::expected< void >::value ( )
noexcept

Returns the contained value.

Precondition
engaged() == true.

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