aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-optional.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/util/rust-optional.h')
-rw-r--r--gcc/rust/util/rust-optional.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-optional.h b/gcc/rust/util/rust-optional.h
index 66730bd..30880cd 100644
--- a/gcc/rust/util/rust-optional.h
+++ b/gcc/rust/util/rust-optional.h
@@ -250,6 +250,16 @@ public:
}
};
+template <typename T, typename U>
+bool
+operator== (const Optional<T> &t, const Optional<U> &u)
+{
+ if (t.is_some ())
+ return u.is_some () && t.get () == u.get ();
+ else
+ return u.is_none ();
+}
+
} // namespace Rust
namespace std {