From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 5E2463858D35 for ; Mon, 22 May 2023 20:55:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E2463858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684788954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bq3Cqkqk8qOcQ1fP0kL0jikUppxFMCTf0mtoDc4+o+Y=; b=bDRQsteuceJux1NIFFzQXhVjhFLXygwXu2uFAiBS4Apgw2fH4QleQyvNfFx26n7kP2ydEl Fljt1gBRBrw+dwFBUaDN4coQY9NI7mPPaDOwG2GUgzDSU6TGbaZIv9VVk4EC59gvIYB9xG 5Uh6s1boje3MHS/0EfaLlyLB57myXCM= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-369-m8LjjWGKORC66mPjs4oyeQ-1; Mon, 22 May 2023 16:55:52 -0400 X-MC-Unique: m8LjjWGKORC66mPjs4oyeQ-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4f3f9e8a887so1000645e87.3 for ; Mon, 22 May 2023 13:55:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684788950; x=1687380950; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bq3Cqkqk8qOcQ1fP0kL0jikUppxFMCTf0mtoDc4+o+Y=; b=VEEUYToTkWw1fya7hWi/BiuGNsTX9n05xG3VauH5K0sCEgESd78KeRa3/miKGRR3O0 YZelV6dWc9GM/KAywEOoydk4eusZ0+TLKGtlG4pYYOb6vKF9mC7uva7jeL834TRj3u81 pWoy/wxDBYh6yMH8ij7YJcuriGKTIM/Goetng6lrg58MRlkvtXrFRMj9Pr4umCpbXtwR 1PgrFUGVzhBDsGWQ5gf8IrweHHf0eUmZA/PzJhoGh7X4e0V7xS3aqr1qfpZP+94LLIWj oV0Z2+M0J2av3eIjoYqNUkOiaE/XHLhHQCkYMHUE07T5wlwdeYo+sJK2FJZsApIcU5yB 6dpQ== X-Gm-Message-State: AC+VfDz9/QJGreaPTKIHvVTFreL3+nyLKr0GkpliTue1NYmPjfFb+xPc XcPY5OdLHtDou25HfhIf9WV4HxSjt6o5HcJnoXEo4ZPQjip8xt70464+USiuh3uCdJLxtepzDOB Txc8FdjCssrNMqOF6AvH/C2myR5GuQuN2tXgWBlcrtA== X-Received: by 2002:ac2:5fae:0:b0:4f1:1de7:1aac with SMTP id s14-20020ac25fae000000b004f11de71aacmr3352453lfe.20.1684788950724; Mon, 22 May 2023 13:55:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+7Lm3ic6AMbADXE7GX6WkoUbSZ5468c+lciYdOlP702YA4wQ4wEOvF9lsdg2WbGSXU1z5iZeBK5ykuxXWme4= X-Received: by 2002:ac2:5fae:0:b0:4f1:1de7:1aac with SMTP id s14-20020ac25fae000000b004f11de71aacmr3352445lfe.20.1684788950402; Mon, 22 May 2023 13:55:50 -0700 (PDT) MIME-Version: 1.0 References: <9fbe09f1-ea49-b520-251b-faba47d74179@gmail.com> In-Reply-To: <9fbe09f1-ea49-b520-251b-faba47d74179@gmail.com> From: Jonathan Wakely Date: Mon, 22 May 2023 21:55:38 +0100 Message-ID: Subject: Re: [PATCH] Replace __gnu_cxx::__ops::__negate with std::not_fn To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++" , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000e91f2305fc4e7eff" X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000e91f2305fc4e7eff Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 22 May 2023 at 21:51, Fran=C3=A7ois 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 . 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 > 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 . > > 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 . > No, please don't include anywhere. If you do that, it means 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 . > [__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 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 include by > . > > Tests still running. > > Fran=C3=A7ois > > --000000000000e91f2305fc4e7eff--