public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-1249] libstdc++: Add relational operators to __gnu_test::PointerBase Date: Thu, 25 May 2023 23:17:15 +0000 (GMT) [thread overview] Message-ID: <20230525231715.77CC5385842A@sourceware.org> (raw) https://gcc.gnu.org/g:8d2fa90a41567670d2dbd4918d19d21d9bec4a8f commit r14-1249-g8d2fa90a41567670d2dbd4918d19d21d9bec4a8f Author: Jonathan Wakely <jwakely@redhat.com> Date: Thu May 25 21:17:19 2023 +0100 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. Diff: --- libstdc++-v3/testsuite/util/testsuite_allocator.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index 9108ee40821..70dacb3fdf2 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); }
reply other threads:[~2023-05-25 23:17 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230525231715.77CC5385842A@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).