From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Replace __gnu_cxx::__ops::__negate with std::not_fn
Date: Mon, 22 May 2023 21:55:38 +0100 [thread overview]
Message-ID: <CACb0b4n07jjF0dc6wSPkAsN1P0RkiDYyfd=r15yGcsEhiT239w@mail.gmail.com> (raw)
In-Reply-To: <9fbe09f1-ea49-b520-251b-faba47d74179@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2136 bytes --]
On Mon, 22 May 2023 at 21:51, François Dumont via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:
> I was thinking that it might be nice to get rid of predefined_ops.h
> content.
>
> So here is a start with __negate. Drawback is that stl_algo.h has to
> include <functional>.
We definitely don't want that. std::not_fn could be move to its own header.
But I'm not sure this is a good change anyway, as we can't do it
unconditionally. Pre-C++17 code would still be using the predefined_ops.h
function objects, so we can't remove that code. And we'll get template
bloat from instantiating the algos twice, once with the old function
objects and once with std::not_fn.
> For now I just get rid of stl_algo.h include in
> <functional> to rather use stl_algobase.h. But maybe it would be better
> to also isolate std::not_fn in a dedicated header file so that
> stl_algo.h do not have to include all <functional>.
>
> libstdc++: Replace __gnu_cxx::__ops::__negate with std::not_fn
>
> Replace the internal __gnu_cxx::__ops::__negate function and
> associated
> __gnu_cxx::__ops::_Iter_negate by the C++17 std::not_fn.
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/predefined_ops.h: Include <version>.
>
No, please don't include <version> anywhere. If you do that, it means
<functional> now defines every feature test macro in the entire library,
which makes it look like you can get smart pointers and ranges and
constexpr math all from <functional>.
> [__cpp_lib_not_fn](__gnu_cxx::__ops::_Iter_negate): Remove.
> [__cpp_lib_not_fn](__gnu_cxx::__ops::__negate): Remove.
> * include/bits/stl_algo.h: Include <functional> for C++17
> and later.
> [__cpp_lib_not_fn](__find_if_not): Use std::not_fn.
> (std::__search, std::search(_FwdIt1, _FwdIt1, _FwdIt2,
> _FwdIt2, _BinPred)): Move...
> * include/bits/stl_algobase.h: ...here.
> * include/std/functional: Replace <stl_algo.h> include by
> <stl_algobase.h>.
>
> Tests still running.
>
> François
>
>
next prev parent reply other threads:[~2023-05-22 20:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 20:50 François Dumont
2023-05-22 20:55 ` Jonathan Wakely [this message]
2023-05-24 4: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='CACb0b4n07jjF0dc6wSPkAsN1P0RkiDYyfd=r15yGcsEhiT239w@mail.gmail.com' \
--to=jwakely@redhat.com \
--cc=frs.dumont@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--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).