13 #ifndef __STOUT_RESULT_HPP__
14 #define __STOUT_RESULT_HPP__
62 : data(
Some(std::move(_t))) {}
66 typename =
typename std::enable_if<
67 std::is_constructible<T, const U&>::value>
::type>
118 std::string errorMessage =
"Result::get() but state == ";
120 errorMessage +=
"ERROR: " + data.
error();
122 errorMessage +=
"NONE";
126 return data.
get().get();
131 return const_cast<T&
>(
static_cast<const Result&
>(*this).
get());
146 #endif // __STOUT_RESULT_HPP__
bool isNone() const
Definition: result.hpp:112
Definition: errorbase.hpp:35
Result(const _Some< U > &some)
Definition: result.hpp:85
Definition: option.hpp:28
#define ABORT(...)
Definition: abort.hpp:40
Result(const Try< T > &_t)
Definition: result.hpp:76
Result(const U &u)
Definition: result.hpp:68
static Result< T > error(const std::string &message)
Definition: result.hpp:53
Definition: error.hpp:106
Result< T > & operator=(const Result< T > &that)=default
Definition: errorbase.hpp:49
const T * operator->() const
Definition: result.hpp:134
Definition: result.hpp:40
Result(const None &none)
Definition: result.hpp:81
Result(const T &_t)
Definition: result.hpp:58
Result(const Error &error)
Definition: result.hpp:88
Result(T &&_t)
Definition: result.hpp:61
static Result< T > some(const T &t)
Definition: result.hpp:48
bool isSome() const
Definition: try.hpp:70
const T & get() const
Definition: result.hpp:115
static Try error(const E &e)
Definition: try.hpp:42
T * operator->()
Definition: result.hpp:135
_Some< typename std::decay< T >::type > Some(T &&t)
Definition: some.hpp:42
bool isError() const
Definition: try.hpp:71
Try< uint32_t > type(const std::string &path)
bool isSome() const
Definition: result.hpp:111
bool isError() const
Definition: result.hpp:113
Result(const ErrnoError &error)
Definition: result.hpp:91
const std::string & error() const
Definition: result.hpp:137
const T & get() const
Definition: try.hpp:73
static Result< T > none()
Definition: result.hpp:43
Result(const Option< T > &option)
Definition: result.hpp:71