diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-05-25 21:17:19 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-05-26 00:14:43 +0100 |
commit | 8d2fa90a41567670d2dbd4918d19d21d9bec4a8f (patch) | |
tree | 9c6bab2390ff016051f786ea3ab4940ff3b6c52b | |
parent | d156c6054200237b707f9fb44ae9958d926b0745 (diff) | |
download | gcc-8d2fa90a41567670d2dbd4918d19d21d9bec4a8f.zip gcc-8d2fa90a41567670d2dbd4918d19d21d9bec4a8f.tar.gz gcc-8d2fa90a41567670d2dbd4918d19d21d9bec4a8f.tar.bz2 |
libstdc++: Add relational operators to __gnu_test::PointerBase
The Cpp17Allocator requirements say that an allocator's pointer and
const_pointer types must meet the Cpp17RandomAccessIterator
requirements. That means our PointerBase helper for defining fancy
pointer types should support the full set of relational operators.
libstdc++-v3/ChangeLog:
* testsuite/util/testsuite_allocator.h (PointerBase): Add
relational operators.
-rw-r--r-- | libstdc++-v3/testsuite/util/testsuite_allocator.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index 9108ee4..70dacb3 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -719,6 +719,15 @@ namespace __gnu_test friend std::ptrdiff_t operator-(PointerBase l, PointerBase r) { return l.value - r.value; } + friend bool operator<(PointerBase l, PointerBase r) + { return l.value < r.value; } + friend bool operator>(PointerBase l, PointerBase r) + { return l.value > r.value; } + friend bool operator<=(PointerBase l, PointerBase r) + { return l.value <= r.value; } + friend bool operator>=(PointerBase l, PointerBase r) + { return l.value >= r.value; } + Derived& derived() { return static_cast<Derived&>(*this); } |