public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Patrick Palka <ppalka@redhat.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Patrick Palka <ppalka@redhat.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	 libstdc++ <libstdc++@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++/ranges: Define _S_has_simple_call_op on newer adaptors
Date: Wed, 27 Mar 2024 08:46:05 -0400 (EDT)	[thread overview]
Message-ID: <f39256f4-01eb-7f85-2e8b-7dded70ef126@idea> (raw)
In-Reply-To: <CAH6eHdRrHHDSN8=MjgfXHNqHQQ+QgSDrkAjoLxkBryTo1e8ugw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3413 bytes --]

On Wed, 17 Jan 2024, Jonathan Wakely wrote:

> 
> 
> On Wed, 17 Jan 2024, 02:37 Patrick Palka, <ppalka@redhat.com> wrote:
>       Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
> 
> 
> OK

Thanks a lot.  For the record I ended up not pushing this patch because
all the range adaptors it touches are C++23 ones and so ...

> 
> 
> 
>       -- >8 --
> 
>       This compile-time and diagnostic improvement[1] is less important in
>       C++23 mode where deducing this is available and used in _Pipe, but for
>       benefit of C++20 mode

... this isn't true.  There's no real benefit in setting this flag for
standard C++23 range adaptors (besides consistency I guess, but OTOH not
setting it means more testing coverage for the deducing this code path).

> and for consistency let's set the flag on the most
>       recently added range adaptors which lack it.
> 
>       [1]: Defining _S_has_simple_call_op=true for a range adaptor closure
>       object signals that the adaptor has an operator() that's not overloaded
>       according to the constness/value category of the object, which in turn
>       allows us to implement the operator() of the composition of such adaptors
>       in a simpler way.
> 
>       libstdc++-v3/ChangeLog:
> 
>               * include/std/ranges (views::_Adjacent::_S_has_simple_call_op):
>               Define to true.
>               (views::_AsRvalue::_S_has_simple_call_op): Likewise.
>               (views::_Enumerate::_S_has_simple_call_op): Likewise.
>               (views::_AsConst::_S_has_simple_call_op): Likewise.
>       ---
>        libstdc++-v3/include/std/ranges | 8 ++++++++
>        1 file changed, 8 insertions(+)
> 
>       diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
>       index 7ef835f486a..66502cc1da4 100644
>       --- a/libstdc++-v3/include/std/ranges
>       +++ b/libstdc++-v3/include/std/ranges
>       @@ -5669,6 +5669,8 @@ namespace views::__adaptor
>                   else
>                     return adjacent_view<all_t<_Range>, _Nm>(std::forward<_Range>(__r));
>                 }
>       +
>       +       static constexpr bool _S_has_simple_call_op = true;
>              };
> 
>            template<size_t _Nm>
>       @@ -8844,6 +8846,8 @@ namespace views::__adaptor
>                 else
>                   return as_rvalue_view(std::forward<_Range>(__r));
>               }
>       +
>       +      static constexpr bool _S_has_simple_call_op = true;
>            };
> 
>            inline constexpr _AsRvalue as_rvalue;
>       @@ -9147,6 +9151,8 @@ namespace views::__adaptor
>               constexpr auto
>               operator() [[nodiscard]] (_Range&& __r) const
>               { return enumerate_view<all_t<_Range>>(std::forward<_Range>(__r)); }
>       +
>       +      static constexpr bool _S_has_simple_call_op = true;
>            };
> 
>            inline constexpr _Enumerate enumerate;
>       @@ -9253,6 +9259,8 @@ namespace views::__adaptor
>               else
>                 return as_const_view(std::forward<_Range>(__r));
>              }
>       +
>       +      static constexpr bool _S_has_simple_call_op = true;
>            };
> 
>            inline constexpr _AsConst as_const;
>       --
>       2.43.0.367.g186b115d30
> 
> 
> 

      reply	other threads:[~2024-03-27 12:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17  2:36 Patrick Palka
2024-01-17  7:22 ` Jonathan Wakely
2024-03-27 12:46   ` Patrick Palka [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=f39256f4-01eb-7f85-2e8b-7dded70ef126@idea \
    --to=ppalka@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.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).