From 3f9fac65a40fff923a42ce196cee260de585aac0 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 6 Dec 2025 14:16:34 -0500 Subject: [PATCH] xo-object: spaceship operator for gp + gp --- include/xo/allocutil/gc_ptr.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; };