public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [committed] libstdc++: Reduce header dependencies for C++20 std::erase [PR92546]
Date: Sat, 2 Oct 2021 13:47:55 +0100	[thread overview]
Message-ID: <CAH6eHdR8YdHKR=esJ4Os6BudiqMdxmy9vREFFdqrx4VR96k+Fg@mail.gmail.com> (raw)
In-Reply-To: <b1a257bb-e81b-bf27-fc63-9f02a8047f9d@gmail.com>

On Sat, 2 Oct 2021, 13:02 François Dumont via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:

> On 01/10/21 9:38 pm, Jonathan Wakely via Libstdc++ wrote:
> > This reduces the preprocessed size of <deque>, <string> and <vector> by
> > not including <bits/stl_algo.h> for std::remove and std::remove_if.
> >
> > Also unwrap iterators using __niter_base, to avoid redundant debug mode
> > checks.
>
> I don't know if you noticed but the __niter_base is a no-op here.
>

Oh, I didn't notice.


> __niter_base unwrap only random access iterators because it is the only
> category for which we know that we have been able to confirm validity or
> not.
>

But these are all random access. I must be missing something.


> We would need to introduce another function to do this or specialize in
> some way erase_if for debug containers. I'll try to find a solution.
>

OK, thanks. Maybe we can just leave the checking there. I wanted to avoid
the overhead because we know that the iterator range is valid. Any checks
done on each increment and equality comparison are wasteful, as they will
never fail.




>
> >
> >       PR libstdc++/92546
> >       * include/bits/erase_if.h (__erase_nodes_if): Use __niter_base to
> >       unwrap debug iterators.
> >       * include/bits/refwrap.h: Do not error if included in C++03.
> >       * include/bits/stl_algo.h (__remove_if): Move to ...
> >       * include/bits/stl_algobase.h (__remove_if): ... here.
> >       * include/std/deque (erase, erase_if): Use __remove_if instead of
> >       remove and remove_if.
> >       * include/std/string (erase, erase_if): Likewise.
> >       * include/std/vector (erase, erase_if): Likewise.
> >
> > Tested powerpc64le-linux. Committed to trunk.
> >
> > ff7793bea46
> > 34e9407b3b4
> > b7e8fb5e482
> > 6ccffeb56b9
> > e79bde6ada4
> > e5c093e515c
> > 20751fad19e
> > 9b790acc220
> > e3869a48fc2
> > 44967af830a
> > dc1b29508d7
> > 59ffa3e3dba
> > d71476c9df9
> > a09bb4a852f
> > cfb582f6279
> > c46ecb0112e
> > fb4d55ef61c
> > 10b6d89badd
> > ce709ad3dc0
> > d335d73889d
> > 681707ec28d
> > 741c7350c08
>
>
>

  reply	other threads:[~2021-10-02 12:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 19:38 Jonathan Wakely
2021-10-02 12:01 ` François Dumont
2021-10-02 12:47   ` Jonathan Wakely [this message]
2021-10-07  6:35     ` François Dumont
2021-10-07  6:51       ` Jonathan Wakely
2021-10-07 14:02         ` Jonathan Wakely
2021-10-07 17:05           ` [committed] libstdc++: Avoid debug checks in uniform container erasure functions Jonathan Wakely
2021-10-07 17:06           ` [committed] libstdc++: Reduce header dependencies for C++20 std::erase [PR92546] François Dumont
2021-10-07 17:16             ` Jonathan Wakely
2021-10-07 17:34               ` François Dumont
2021-10-07 18:34                 ` Jonathan Wakely
2021-10-07 19:51                   ` François Dumont

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='CAH6eHdR8YdHKR=esJ4Os6BudiqMdxmy9vREFFdqrx4VR96k+Fg@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=frs.dumont@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).