Lely core libraries 2.3.5
lely::util::Result< void, void > Class Reference

Public Types

using value_type
 The value type on success.
 
using error_type
 The error type on failure.
 

Public Member Functions

 Result ()=default
 Constructs a successful result with an empty value.
 
 Result (const detail::Success< void > &)
 Constructs a successful result with an empty value.
 
 Result (const detail::Success< U > &s)
 Constructs a successful result with the specified value.
 
 Result (detail::Success< U > &&s)
 Constructs a successful result with the specified value.
 
 Result (const detail::Failure< U > &f)
 Constructs a failure result with the specified error.
 
 Result (detail::Failure< U > &&f)
 Constructs a failure result with the specified error.
 
 Result (U &&u, typename ::std::enable_if< ::std::is_constructible< value_type, U >::value &&!::std::is_constructible< error_type, U >::value, bool >::type=false)
 Constructs a successful result with value u if U is constructible to value_type and not constructible to error_type.
 
 Result (U &&u, typename ::std::enable_if< !::std::is_constructible< value_type, U >::value &&::std::is_constructible< error_type, U >::value, bool >::type=false)
 Constructs a failure result with error u if U is constructible to error_type and not constructible to value_type.
 
 operator bool () const noexcept
 Check whether *this contains a value (and not a non-zero error).
 
bool has_value () const noexcept
 Returns true if *this contains a value (and not a non-zero error).
 
value_type & value ()
 Returns a reference to the value if *this contains a value, and throws an exception if *this contains a non-zero error.
 
const value_type & value () const
 Returns a reference to the value if *this contains a value, and throws an exception if *this contains a non-zero error.
 
bool has_error () const noexcept
 Returns true if *this contains a non-zero error.
 
error_type & error () noexcept
 Returns a reference to the error, if any.
 
const error_type & error () const noexcept
 Returns a reference to the error, if any.
 

Detailed Description

Definition at line 421 of file result.hpp.

Constructor & Destructor Documentation

◆ Result() [1/5]

lely::util::Result< void, void >::Result ( const detail::Success< void > & )
inline

Constructs a successful result with an empty value.

See also
success()

Definition at line 214 of file result.hpp.

◆ Result() [2/5]

lely::util::Result< void, void >::Result ( const detail::Success< U > & s)
inline

Constructs a successful result with the specified value.

See also
success(T&&)

Definition at line 218 of file result.hpp.

◆ Result() [3/5]

lely::util::Result< void, void >::Result ( detail::Success< U > && s)
inline

Constructs a successful result with the specified value.

See also
success(T&&)

Definition at line 222 of file result.hpp.

◆ Result() [4/5]

lely::util::Result< void, void >::Result ( const detail::Failure< U > & f)
inline

Constructs a failure result with the specified error.

See also
failure(E&&)

Definition at line 226 of file result.hpp.

◆ Result() [5/5]

lely::util::Result< void, void >::Result ( detail::Failure< U > && f)
inline

Constructs a failure result with the specified error.

See also
failure(E&&)

Definition at line 230 of file result.hpp.

Member Function Documentation

◆ has_value()

bool lely::util::Result< void, void >::has_value ( ) const
inlinenoexcept

Returns true if *this contains a value (and not a non-zero error).

See also
has_error()

Definition at line 265 of file result.hpp.

◆ has_error()

bool lely::util::Result< void, void >::has_error ( ) const
inlinenoexcept

Returns true if *this contains a non-zero error.

See also
has_value()

Definition at line 291 of file result.hpp.


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