public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Patrick Palka <ppalka@redhat.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: [PATCH 2/3] libstdc++: Simplify copy-pasted algorithms in <ranges>
Date: Thu, 1 Apr 2021 15:07:22 +0100	[thread overview]
Message-ID: <20210401140722.GS3008@redhat.com> (raw)
In-Reply-To: <20210329184915.3921422-2-ppalka@redhat.com>

On 29/03/21 14:49 -0400, Patrick Palka via Libstdc++ wrote:
>The <ranges> header currently copies some simple algorithms from
><bits/ranges_algo.h>, which was originally done in order to avoid a
>circular dependency with the header.  This is no longer an issue since
>the latter header now includes <bits/ranges_util.h> instead of all of
><ranges>.
>
>This means we could now just include <bits/ranges_algo.h> and remove the
>copied algorithms, but that would double the size of <ranges>.  And we
>can't use the corresponding STL-style algorithms here because they
>assume input iterators are copyable.  So this patch instead simplifies
>these copied algorithms, removing their constraints and unused
>parameters, and keeps them around.  In a subsequent patch we're going to
>copy ranges::find into <ranges> as well.
>
>libstdc++-v3/ChangeLog:
>
>	* include/std/ranges (__detail::find_if): Simplify.
>	(__detail::find_if_not): Likewise.
>	(__detail::min): Remove.
>	(__detail::mismatch): Simplify.
>	(take_view::size): Use std::min instead of __detail::min.

I wonder if we want a <bits/ranges_algobase.h> which has this subset
of algos. That could be used from <ranges> and also from the real
algos in <bits/ranges_algo.h>. The ones in ranges_algobase.h wouldn't
need to have the constraints (because we know the caller is
constrained, or uses them correctly), but for that to work the unused
params would need to be re-added. We can consider that for GCC 12
though.

So OK for GCC 11.


  parent reply	other threads:[~2021-04-01 14:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 18:49 [PATCH 1/3] libstdc++: Fix elements_view::operator* and operator[] [LWG 3502] Patrick Palka
2021-03-29 18:49 ` [PATCH 2/3] libstdc++: Simplify copy-pasted algorithms in <ranges> Patrick Palka
2021-03-29 18:53   ` Patrick Palka
2021-04-01 14:07   ` Jonathan Wakely [this message]
2021-03-29 18:49 ` [PATCH 3/3] libstdc++: Fix split_view::_OuterIter::operator++ [LWG 3505] Patrick Palka
2021-04-01 14:03   ` Jonathan Wakely
2021-04-01 14:00 ` [PATCH 1/3] libstdc++: Fix elements_view::operator* and operator[] [LWG 3502] Jonathan Wakely

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=20210401140722.GS3008@redhat.com \
    --to=jwakely@redhat.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).