YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
yaclib::Result< ValueT, E > Class Template Reference

Encapsulated return value from caller. More...

#include <result.hpp>

Inheritance diagram for yaclib::Result< ValueT, E >:
[legend]

Public Member Functions

 Result (Result &&other) noexcept(std::is_nothrow_move_constructible_v< Variant >)=default
 
 Result (const Result &other) noexcept(std::is_nothrow_copy_constructible_v< Variant >)=default
 
Resultoperator= (Result &&other) noexcept(std::is_nothrow_move_assignable_v< Variant >)=default
 
Resultoperator= (const Result &other) noexcept(std::is_nothrow_copy_assignable_v< Variant >)=default
 
template<typename... Args, typename = std::enable_if_t<(sizeof...(Args) > 1 || !std::is_same_v<std::decay_t<head_t<Args&&...>>, Result>), void>>
 Result (Args &&... args) noexcept(std::is_nothrow_constructible_v< Variant, std::in_place_type_t< V >, Args &&... >)
 
template<typename... Args>
 Result (std::in_place_t, Args &&... args) noexcept(std::is_nothrow_constructible_v< Variant, std::in_place_type_t< V >, Args &&... >)
 
 Result (std::exception_ptr exception) noexcept
 
 Result (E error) noexcept
 
 Result (StopTag tag) noexcept
 
 Result () noexcept
 
template<typename Arg , typename = std::enable_if_t<!is_result_v<std::decay_t<Arg>>, void>>
Resultoperator= (Arg &&arg) noexcept(std::is_nothrow_assignable_v< Variant, Arg >)
 
 operator bool () const noexcept
 
void Ok () &=delete
 
void Ok () const &&=delete
 
void Value () &=delete
 
void Value () const &&=delete
 
void Exception () &=delete
 
void Exception () const &&=delete
 
void Error () &=delete
 
void Error () const &&=delete
 
V && Ok () &&
 
const V & Ok () const &
 
ResultState State () const noexcept
 
V && Value () &&noexcept
 
const V & Value () const &noexcept
 
std::exception_ptr && Exception () &&noexcept
 
const std::exception_ptr & Exception () const &noexcept
 
E && Error () &&noexcept
 
const EError () const &noexcept
 
Variant & Internal ()
 

Detailed Description

template<typename ValueT, typename E>
class yaclib::Result< ValueT, E >

Encapsulated return value from caller.

Template Parameters
ValueTtype of value that stored in Result
Etype of error that stored in Result
Examples
simple.cpp.

Definition at line 90 of file result.hpp.

Constructor & Destructor Documentation

◆ Result() [1/8]

template<typename ValueT , typename E >
yaclib::Result< ValueT, E >::Result ( Result< ValueT, E > &&  other) const
defaultnoexcept

◆ Result() [2/8]

template<typename ValueT , typename E >
yaclib::Result< ValueT, E >::Result ( const Result< ValueT, E > &  other) const
defaultnoexcept

◆ Result() [3/8]

template<typename ValueT , typename E >
template<typename... Args, typename = std::enable_if_t<(sizeof...(Args) > 1 || !std::is_same_v<std::decay_t<head_t<Args&&...>>, Result>), void>>
yaclib::Result< ValueT, E >::Result ( Args &&...  args)
inlinenoexcept

Definition at line 107 of file result.hpp.

◆ Result() [4/8]

template<typename ValueT , typename E >
template<typename... Args>
yaclib::Result< ValueT, E >::Result ( std::in_place_t  ,
Args &&...  args 
)
inlinenoexcept

Definition at line 112 of file result.hpp.

◆ Result() [5/8]

template<typename ValueT , typename E >
yaclib::Result< ValueT, E >::Result ( std::exception_ptr  exception)
inlinenoexcept

Definition at line 117 of file result.hpp.

◆ Result() [6/8]

template<typename ValueT , typename E >
yaclib::Result< ValueT, E >::Result ( E  error)
inlinenoexcept

Definition at line 121 of file result.hpp.

References yaclib::MakeContract().

◆ Result() [7/8]

template<typename ValueT , typename E >
yaclib::Result< ValueT, E >::Result ( StopTag  tag)
inlinenoexcept

Definition at line 124 of file result.hpp.

References yaclib::MakeContract().

◆ Result() [8/8]

template<typename ValueT , typename E >
yaclib::Result< ValueT, E >::Result ( )
inlinenoexcept

Definition at line 127 of file result.hpp.

Member Function Documentation

◆ Error() [1/4]

template<typename ValueT , typename E >
E && yaclib::Result< ValueT, E >::Error ( ) &&
inlinenoexcept

Definition at line 174 of file result.hpp.

◆ Error() [2/4]

template<typename ValueT , typename E >
void yaclib::Result< ValueT, E >::Error ( ) &
delete

◆ Error() [3/4]

template<typename ValueT , typename E >
void yaclib::Result< ValueT, E >::Error ( ) const &&
delete

◆ Error() [4/4]

template<typename ValueT , typename E >
const E & yaclib::Result< ValueT, E >::Error ( ) const &
inlinenoexcept

Definition at line 177 of file result.hpp.

◆ Exception() [1/4]

template<typename ValueT , typename E >
std::exception_ptr && yaclib::Result< ValueT, E >::Exception ( ) &&
inlinenoexcept

Definition at line 167 of file result.hpp.

◆ Exception() [2/4]

◆ Exception() [3/4]

template<typename ValueT , typename E >
void yaclib::Result< ValueT, E >::Exception ( ) const &&
delete

◆ Exception() [4/4]

template<typename ValueT , typename E >
const std::exception_ptr & yaclib::Result< ValueT, E >::Exception ( ) const &
inlinenoexcept

Definition at line 170 of file result.hpp.

◆ Internal()

template<typename ValueT , typename E >
Variant & yaclib::Result< ValueT, E >::Internal ( )
inline

Definition at line 181 of file result.hpp.

◆ Ok() [1/4]

template<typename ValueT , typename E >
V && yaclib::Result< ValueT, E >::Ok ( ) &&
inline

Definition at line 149 of file result.hpp.

◆ Ok() [2/4]

template<typename ValueT , typename E >
void yaclib::Result< ValueT, E >::Ok ( ) &
delete

◆ Ok() [3/4]

template<typename ValueT , typename E >
const V & yaclib::Result< ValueT, E >::Ok ( ) const &
inline

Definition at line 152 of file result.hpp.

◆ Ok() [4/4]

template<typename ValueT , typename E >
void yaclib::Result< ValueT, E >::Ok ( ) const &&
delete

◆ operator bool()

template<typename ValueT , typename E >
yaclib::Result< ValueT, E >::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 136 of file result.hpp.

References yaclib::Result< ValueT, E >::State(), and yaclib::Value.

◆ operator=() [1/3]

template<typename ValueT , typename E >
template<typename Arg , typename = std::enable_if_t<!is_result_v<std::decay_t<Arg>>, void>>
Result & yaclib::Result< ValueT, E >::operator= ( Arg &&  arg)
inlinenoexcept

Definition at line 131 of file result.hpp.

References yaclib::MakeContract().

◆ operator=() [2/3]

template<typename ValueT , typename E >
Result & yaclib::Result< ValueT, E >::operator= ( const Result< ValueT, E > &  other)
defaultnoexcept

◆ operator=() [3/3]

template<typename ValueT , typename E >
Result & yaclib::Result< ValueT, E >::operator= ( Result< ValueT, E > &&  other)
defaultnoexcept

◆ State()

template<typename ValueT , typename E >
ResultState yaclib::Result< ValueT, E >::State ( ) const
inlinenoexcept

Definition at line 156 of file result.hpp.

Referenced by yaclib::Result< ValueT, E >::operator bool().

◆ Value() [1/4]

template<typename ValueT , typename E >
V && yaclib::Result< ValueT, E >::Value ( ) &&
inlinenoexcept

Definition at line 160 of file result.hpp.

◆ Value() [2/4]

template<typename ValueT , typename E >
void yaclib::Result< ValueT, E >::Value ( ) &
delete

◆ Value() [3/4]

template<typename ValueT , typename E >
void yaclib::Result< ValueT, E >::Value ( ) const &&
delete

◆ Value() [4/4]

template<typename ValueT , typename E >
const V & yaclib::Result< ValueT, E >::Value ( ) const &
inlinenoexcept

Definition at line 163 of file result.hpp.


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