summaryrefslogtreecommitdiff
path: root/src/compat/result.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compat/result.hpp')
-rw-r--r--src/compat/result.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compat/result.hpp b/src/compat/result.hpp
index f03c026..6adc552 100644
--- a/src/compat/result.hpp
+++ b/src/compat/result.hpp
@@ -66,7 +66,23 @@ namespace tmwa
{
return Result<T>(magic_flag, message);
}
+ template<class T>
+ operator Option<Result<T>>()
+ {
+ return Some(Result<T>(magic_flag, message));
+ }
};
+
+ template<class T>
+ bool operator == (const Result<T>& l, const Result<T>& r)
+ {
+ return l.get_success() == r.get_success() && l.get_failure() == r.get_failure();
+ }
+ template<class T>
+ bool operator != (const Result<T>& l, const Result<T>& r)
+ {
+ return !(l == r);
+ }
} // namespace result
using result::Result;
using result::Ok;