diff options
-rw-r--r-- | gcc/rust/util/rust-optional.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-optional.h b/gcc/rust/util/rust-optional.h index 3b3f110..658d90f 100644 --- a/gcc/rust/util/rust-optional.h +++ b/gcc/rust/util/rust-optional.h @@ -228,6 +228,18 @@ public: } // namespace Rust +namespace std { + +template <typename T> struct hash<Rust::Optional<T>> +{ + size_t operator() (const Rust::Optional<T> &op) const + { + return op.is_some () ? std::hash<T> () (op.get ()) : 0; + } +}; + +} // namespace std + #ifdef CHECKING_P void |