Bitcoin ABC 0.30.5
P2P Digital Currency
Public Member Functions | Private Types | Private Attributes | Friends | List of all members
util::Result< M > Class Template Reference

#include <result.h>

Public Member Functions

 Result ()
 
 Result (T obj)
 
 Result (Error error)
 
bool has_value () const noexcept
 std::optional methods, so functions returning optional<T> can change to return Result<T> with minimal changes to existing code, and vice versa. More...
 
const Tvalue () const LIFETIMEBOUND
 
Tvalue () LIFETIMEBOUND
 
template<class U >
T value_or (U &&default_value) const &
 
template<class U >
T value_or (U &&default_value) &&
 
 operator bool () const noexcept
 
const Toperator-> () const LIFETIMEBOUND
 
const Toperator* () const LIFETIMEBOUND
 
Toperator-> () LIFETIMEBOUND
 
Toperator* () LIFETIMEBOUND
 

Private Types

using T = std::conditional_t< std::is_same_v< M, void >, std::monostate, M >
 

Private Attributes

std::variant< bilingual_str, Tm_variant
 

Friends

template<typename FT >
bilingual_str ErrorString (const Result< FT > &result)
 

Detailed Description

template<class M>
class util::Result< M >

Definition at line 37 of file result.h.

Member Typedef Documentation

◆ T

template<class M >
using util::Result< M >::T = std::conditional_t<std::is_same_v<M, void>, std::monostate, M>
private

Definition at line 39 of file result.h.

Constructor & Destructor Documentation

◆ Result() [1/3]

template<class M >
util::Result< M >::Result ( )
inline

Definition at line 48 of file result.h.

◆ Result() [2/3]

template<class M >
util::Result< M >::Result ( T  obj)
inline

Definition at line 49 of file result.h.

◆ Result() [3/3]

template<class M >
util::Result< M >::Result ( Error  error)
inline

Definition at line 50 of file result.h.

Member Function Documentation

◆ has_value()

template<class M >
bool util::Result< M >::has_value ( ) const
inlinenoexcept

std::optional methods, so functions returning optional<T> can change to return Result<T> with minimal changes to existing code, and vice versa.

Definition at line 55 of file result.h.

◆ operator bool()

template<class M >
util::Result< M >::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 71 of file result.h.

◆ operator*() [1/2]

template<class M >
const T & util::Result< M >::operator* ( ) const
inline

Definition at line 73 of file result.h.

◆ operator*() [2/2]

template<class M >
T & util::Result< M >::operator* ( )
inline

Definition at line 75 of file result.h.

◆ operator->() [1/2]

template<class M >
const T * util::Result< M >::operator-> ( ) const
inline

Definition at line 72 of file result.h.

◆ operator->() [2/2]

template<class M >
T * util::Result< M >::operator-> ( )
inline

Definition at line 74 of file result.h.

◆ value() [1/2]

template<class M >
const T & util::Result< M >::value ( ) const
inline

Definition at line 56 of file result.h.

Here is the call graph for this function:

◆ value() [2/2]

template<class M >
T & util::Result< M >::value ( )
inline

Definition at line 60 of file result.h.

Here is the call graph for this function:

◆ value_or() [1/2]

template<class M >
template<class U >
T util::Result< M >::value_or ( U &&  default_value) &&
inline

Definition at line 67 of file result.h.

◆ value_or() [2/2]

template<class M >
template<class U >
T util::Result< M >::value_or ( U &&  default_value) const &
inline

Definition at line 64 of file result.h.

Friends And Related Function Documentation

◆ ErrorString

template<class M >
template<typename FT >
bilingual_str ErrorString ( const Result< FT > &  result)
friend

Member Data Documentation

◆ m_variant

template<class M >
std::variant<bilingual_str, T> util::Result< M >::m_variant
private

Definition at line 41 of file result.h.


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