YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
yaclib_ext::ExpectedTrait< E > Struct Template Reference

Result trait that plugs std::expected<V, E> into yaclib,. More...

#include <expected.hpp>

Public Types

template<typename V >
using Result = std::expected< V, E >
 
using Error = E
 
template<typename R >
using Value = typename yaclib::detail::InstantiationTypes< std::expected, R >::Value
 

Static Public Member Functions

template<typename V , typename... Args>
static Result< V > MakeResult (Args &&... args)
 
template<typename V >
static bool Ok (const Result< V > &r) noexcept
 
template<typename R >
static decltype(auto) GetValue (R &&r) noexcept
 
template<typename R >
static decltype(auto) GetError (R &&r) noexcept
 
template<typename R >
static decltype(auto) Get (R &&r)
 
static bool IsStop (const E &error) noexcept
 

Detailed Description

template<typename E>
struct yaclib_ext::ExpectedTrait< E >

Result trait that plugs std::expected<V, E> into yaclib,.

See also
yaclib::ResultTrait for the contract

Requirements for E:

  • E(yaclib::StopTag) constructs the cancellation error
  • E(std::exception_ptr) converts an exception thrown by user callback
  • operator== to recognize cancellation,
    See also
    IsStop

Definition at line 22 of file expected.hpp.

Member Typedef Documentation

◆ Error

template<typename E >
using yaclib_ext::ExpectedTrait< E >::Error = E

Definition at line 29 of file expected.hpp.

◆ Result

template<typename E >
template<typename V >
using yaclib_ext::ExpectedTrait< E >::Result = std::expected<V, E>

Definition at line 27 of file expected.hpp.

◆ Value

template<typename E >
template<typename R >
using yaclib_ext::ExpectedTrait< E >::Value = typename yaclib::detail::InstantiationTypes<std::expected, R>::Value

Definition at line 32 of file expected.hpp.

Member Function Documentation

◆ Get()

template<typename E >
template<typename R >
static decltype(auto) yaclib_ext::ExpectedTrait< E >::Get ( R &&  r)
inlinestatic

Definition at line 72 of file expected.hpp.

◆ GetError()

template<typename E >
template<typename R >
static decltype(auto) yaclib_ext::ExpectedTrait< E >::GetError ( R &&  r)
inlinestaticnoexcept

Definition at line 67 of file expected.hpp.

◆ GetValue()

template<typename E >
template<typename R >
static decltype(auto) yaclib_ext::ExpectedTrait< E >::GetValue ( R &&  r)
inlinestaticnoexcept

Definition at line 58 of file expected.hpp.

References yaclib::MakeContract().

◆ IsStop()

template<typename E >
static bool yaclib_ext::ExpectedTrait< E >::IsStop ( const E &  error)
inlinestaticnoexcept

Definition at line 76 of file expected.hpp.

References yaclib::MakeContract().

◆ MakeResult()

template<typename E >
template<typename V , typename... Args>
static Result< V > yaclib_ext::ExpectedTrait< E >::MakeResult ( Args &&...  args)
inlinestatic

Definition at line 35 of file expected.hpp.

◆ Ok()

template<typename E >
template<typename V >
static bool yaclib_ext::ExpectedTrait< E >::Ok ( const Result< V > &  r)
inlinestaticnoexcept

Definition at line 53 of file expected.hpp.


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