public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "François Dumont" <frs.dumont@gmail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++ <libstdc++@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Reimplement __gnu_cxx::__ops operators
Date: Sat, 9 Dec 2023 14:04:14 +0100	[thread overview]
Message-ID: <8ddcf55f-5941-4bc3-916a-2e26cc417b09@gmail.com> (raw)
In-Reply-To: <CACb0b4kkxEEmoYk9dFFGk3t-TBdH_o5HiR5i9YuAbqOD8psYjw@mail.gmail.com>


On 07/12/2023 14:41, Jonathan Wakely wrote:
> On Wed, 6 Dec 2023 at 20:55, François Dumont <frs.dumont@gmail.com> wrote:
>> I think I still got no feedback about this cleanup proposal.
> Can you remind me why we have all those different functions in
> predefined_ops.h in the first place? I think it was to avoid having
> two versions of every algorithm, one that does *l < *r and one that
> does pred(*l, *r), right?
Yes, that was the purpose.
>
> One property of the current code is that _Iter_less_iter will compare
> exactly *lhs < *rhs and so works even with this type, where its
> operator< only accepts non-const arguments:
>
> struct X { bool operator<(X&); };
>
> Doesn't your simplification break that, because the _Less function
> only accepts const references now?

Indeed, I thought more about the problem of const qualification on the 
operator(). This is why _Comp_val is mimicking what _Not_fn does.

To be honnest I even thought that this kind of operator above was more a 
user code issue than a real use case we need to handle. But it looks 
like you, I guess the C++ Standard then, impose to support it.

I'll rework it then, thanks for the proposal below and in your other email.



      parent reply	other threads:[~2023-12-09 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15  5:07 François Dumont
2023-12-06 20:54 ` François Dumont
2023-12-07 13:41   ` Jonathan Wakely
2023-12-07 14:04     ` Jonathan Wakely
2024-04-04 17:24       ` François Dumont
2023-12-09 13:04     ` François Dumont [this message]

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=8ddcf55f-5941-4bc3-916a-2e26cc417b09@gmail.com \
    --to=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@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: link
Be 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).