about summary refs log tree commit diff
path: root/absl/container/internal/test_instance_tracker.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/container/internal/test_instance_tracker.h')
-rw-r--r--absl/container/internal/test_instance_tracker.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/absl/container/internal/test_instance_tracker.h b/absl/container/internal/test_instance_tracker.h
index 032d16d33ffa..3d4b2980ea8b 100644
--- a/absl/container/internal/test_instance_tracker.h
+++ b/absl/container/internal/test_instance_tracker.h
@@ -18,6 +18,8 @@
 #include <cstdlib>
 #include <ostream>
 
+#include "absl/types/compare.h"
+
 namespace absl {
 namespace test_internal {
 
@@ -96,6 +98,14 @@ class BaseCountedInstance {
     return value_ >= x.value_;
   }
 
+  absl::weak_ordering compare(const BaseCountedInstance& x) const {
+    ++num_comparisons_;
+    return value_ < x.value_
+               ? absl::weak_ordering::less
+               : value_ == x.value_ ? absl::weak_ordering::equivalent
+                                    : absl::weak_ordering::greater;
+  }
+
   int value() const {
     if (!is_live_) std::abort();
     return value_;