From: Owen Avery Date: Fri, 19 May 2023 17:15:34 +0000 (-0400) Subject: gccrs: Add operator== for Optional. X-Git-Tag: basepoints/gcc-15~2528 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=014dd0304d9d2f0f32a390226470be4a876e903c;p=thirdparty%2Fgcc.git gccrs: Add operator== for Optional. gcc/rust/ChangeLog: * util/rust-optional.h (operator==): New for Optional == Optional. Signed-off-by: Owen Avery --- diff --git a/gcc/rust/util/rust-optional.h b/gcc/rust/util/rust-optional.h index 66730bd992d9..30880cd41db0 100644 --- a/gcc/rust/util/rust-optional.h +++ b/gcc/rust/util/rust-optional.h @@ -250,6 +250,16 @@ public: } }; +template +bool +operator== (const Optional &t, const Optional &u) +{ + if (t.is_some ()) + return u.is_some () && t.get () == u.get (); + else + return u.is_none (); +} + } // namespace Rust namespace std {