From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 75F33385840E for ; Sat, 2 Oct 2021 12:48:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75F33385840E Received: by mail-wr1-x436.google.com with SMTP id m22so14571489wrb.0 for ; Sat, 02 Oct 2021 05:48:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xGTpXr0JRNdeutreI7zJLFvLohzSTNHAPqfwXxgifWo=; b=JKDi2j9TWX7yXYNPlyFpNZEI6aqYS0o0XUvXYvNgxGf8yezcOgCRAqq/Y9bmMjUDaC ZJLhMba2fU/0FvE7xtk4IgJPDaLI8cCNweg0Rk20S1AyMrdKBrMyP9VW9mSNVN039Hem yJkiIHKrs8r7HO0PuSOYDushHeDCdai0j5qZ4L1Jj7hHrbFtMKPHty6APM6lMGtrpG/7 a0wzMP4ftDJGdjD5IMI4/aeDoGA1jcG11iKwXG80ar1VWpttdFoQsWiRRwz3lm9iHhja HRkAquvNudH1jlurmhJh0e0SNNd5cTSHR39ihTEvjlrKhwrf1+QFgl9e8oaYDB+cXZVu Gpww== X-Gm-Message-State: AOAM531CT2ePZ8nmUpMifd7Nse7q5g2t2OPCsKk4Bc1XedWbPVETdMHD ndHQLEoFlP1bny/pnaMvmX33VGG0iK+S3cYaNp0= X-Google-Smtp-Source: ABdhPJwIxLWb0G4bpO1Ni5CH9cMyNzXyzddaoHXfX5IUBk4hV/92QU+MEyZ04G5xu2gaVVZI+9jKnVS/oR2TtE0AHIQ= X-Received: by 2002:a5d:453b:: with SMTP id j27mr3311049wra.324.1633178887153; Sat, 02 Oct 2021 05:48:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Sat, 2 Oct 2021 13:47:55 +0100 Message-ID: Subject: Re: [committed] libstdc++: Reduce header dependencies for C++20 std::erase [PR92546] To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 12:48:13 -0000 On Sat, 2 Oct 2021, 13:02 Fran=C3=A7ois 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 , and by > > not including 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 > > >