diff --git a/include/xo/allocutil/gc_ptr.hpp b/include/xo/allocutil/gc_ptr.hpp index bb4225a..a7d0974 100644 --- a/include/xo/allocutil/gc_ptr.hpp +++ b/include/xo/allocutil/gc_ptr.hpp @@ -69,6 +69,18 @@ namespace xo { T * operator->() const { return ptr_; } T & operator*() const { return *ptr_; } + auto operator<=>(gc_ptr other) const + requires std::three_way_comparable + { + return *ptr_ <=> *other.ptr_; + } + + bool operator==(gc_ptr other) const + requires std::equality_comparable + { + return *ptr_ == *other.ptr_; + } + private: T * ptr_ = nullptr; };