From owner-freebsd-toolchain@freebsd.org Sat Mar 20 17:48:44 2021 Return-Path: Delivered-To: freebsd-toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DA6B5B0401; Sat, 20 Mar 2021 17:48:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2pCc2x4mz4nwQ; Sat, 20 Mar 2021 17:48:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 3CDBF248C3; Sat, 20 Mar 2021 17:48:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58:0:389b:8b8a:99fb:eeed] (unknown [IPv6:2001:470:7a58:0:389b:8b8a:99fb:eeed]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 085C82CCDB; Sat, 20 Mar 2021 18:48:42 +0100 (CET) From: Dimitry Andric Message-Id: <9125B9BA-5B64-46AD-AB61-032889B0BE82@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_D7ACBEB2-C3A7-4196-B4EC-D6DB66633CD0"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: Looking for std::map::erase_if Date: Sat, 20 Mar 2021 18:48:33 +0100 In-Reply-To: Cc: Willem Jan Withagen , FreeBSD Hackers , FreeBSD Toolchain To: Alan Somers References: <941ef2dc-e6e1-bd30-0533-f6789b1463b5@digiware.nl> <499f895c-d614-86bd-2371-a6dd3ac349d7@digiware.nl> X-Mailer: Apple Mail (2.3654.60.0.2.21) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 17:48:44 -0000 --Apple-Mail=_D7ACBEB2-C3A7-4196-B4EC-D6DB66633CD0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Well, -std=3Dc++20 even, it is that new. :) That said, it's always hazardous to rely on experimental features, they = are effectively unsupported. As shown on e.g. cppreference.com, you can use an equivalent function = that looks like: auto old_size =3D c.size(); for (auto i =3D c.begin(), last =3D c.end(); i !=3D last; ) { if (pred(*i)) { i =3D c.erase(i); } else { ++i; } } -Dimitry > On 20 Mar 2021, at 16:22, Alan Somers wrote: >=20 > I'm just guessing, but I think you should remove the "experimental" = and > build with -std=3Dc++17 . > -Alan >=20 > On Sat, Mar 20, 2021 at 9:06 AM Willem Jan Withagen = wrote: >=20 >> On 20-3-2021 15:46, Alan Somers wrote: >>=20 >> It looks like it's in there. What code are you trying that doesn't = work? >>=20 >> Hi Alan, >>=20 >> I thought so too, but all tries last 2 weeks did not result into = anything >> that got it compiling... >> But could be that I did not try hard enough, real work is pulling a = lot >> atm. >>=20 >> Code is at: >>=20 >> = https://github.com/dillaman/ceph/blob/138d71fb0635682510cadda8e4ad5aaab3f3= 9e44/src/librbd/api/Trash.cc#L299 >>=20 >> Thanx, >> --WjW >>=20 >>=20 >>> grep erase_if /usr/include/c++/v1/map >> void erase_if(map& c, Predicate pred); = // >> C++20 >> void erase_if(multimap& c, Predicate = pred); >> // C++20 >> void erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate = __pred) >> { __libcpp_erase_if_container(__c, __pred); } >> void erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, = _Predicate >> __pred) >> { __libcpp_erase_if_container(__c, __pred); } >>=20 >> On Sat, Mar 20, 2021 at 8:39 AM Willem Jan Withagen via = freebsd-hackers < >> freebsd-hackers@freebsd.org> wrote: >>=20 >>> Hi, >>>=20 >>> [ Trying this on FBSD 12.2 ] >>>=20 >>> In the Ceph code new code uses std::map::erase_if. >>> Which is in Linux imported from >>>=20 >>> Anybody suggestions on libraries to get something matching?? >>>=20 >>> Thanx, >>> --WjW >>> _______________________________________________ >>> freebsd-hackers@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers >>> To unsubscribe, send any mail to = "freebsd-hackers-unsubscribe@freebsd.org >>> " >>>=20 >>=20 >>=20 > _______________________________________________ > freebsd-toolchain@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to = "freebsd-toolchain-unsubscribe@freebsd.org" --Apple-Mail=_D7ACBEB2-C3A7-4196-B4EC-D6DB66633CD0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYFY1cgAKCRCwXqMKLiCW o0K7AKDRg+ynTANYSuoru0z7AvijhLXzXwCgujVObtyYtPaUyg19GqkSVCRlFhI= =ijzk -----END PGP SIGNATURE----- --Apple-Mail=_D7ACBEB2-C3A7-4196-B4EC-D6DB66633CD0--