public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Patrick Palka <ppalka@redhat.com>
Cc: 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, 17 Jan 2024 07:22:26 +0000	[thread overview]
Message-ID: <CAH6eHdRrHHDSN8=MjgfXHNqHQQ+QgSDrkAjoLxkBryTo1e8ugw@mail.gmail.com> (raw)
In-Reply-To: <20240117023641.3389770-1-ppalka@redhat.com>

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

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



> -- >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 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-01-17  7:22 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 [this message]
2024-03-27 12:46   ` Patrick Palka

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='CAH6eHdRrHHDSN8=MjgfXHNqHQQ+QgSDrkAjoLxkBryTo1e8ugw@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ppalka@redhat.com \
    /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).