From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 45E383858D35; Tue, 29 Nov 2022 16:22:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45E383858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669738960; bh=qpv3I2Ml/khHH3WX3m9B4KsLz0Ofv0xXqJocQh8jhHU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CkT4lBN3H3gqSFcfxoVyeXjkO7IhtyXLCbPznt7nq5Bb58n2jhOQdgGsW8a5Tt+55 RhlZBvswUNz7HgTTTho3OwYGOqta7v7YKsWZdbimrTqikB2oiOh3YdtOqcI2s8S6dj gKI6J4HxDGCTcz4jWZxSZ2R4R0oPdI0ZAowl4mRM= From: "chgros at synopsys dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107850] [12 Regression] std::erase_if (map) forces predicate to takes a const value_type Date: Tue, 29 Nov 2022 16:22:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: chgros at synopsys dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107850 --- Comment #8 from Charles-Henri Gros --- Thanks for all the comments. I agree that for consistency this should be rejected, though my preference would still be to make remove_if/erase_if mo= re useful in practical cases (this happens dozens of times in codebase, just f= or map. For vector, it's likely a lot more). The predicate should be called exactly once per element so lack of side effect on the element is not really relevant. Anyway, that's a discussion for another forum.=