summaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-11-03 13:35:54 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-11-04 20:10:50 -0800
commit1853e964e96c41e762ca0ab97259ee4e79d86ec7 (patch)
treeedc76f58ed786263a28da79564786f4d75400092 /src/compat
parent1a00fe4ea75924bfe594c4d92073cc95eaa2f32d (diff)
downloadtmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.gz
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.bz2
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.xz
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.zip
Use the new ASTs
Diffstat (limited to 'src/compat')
-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;