[libcxx-commits] [libcxx] [libc++] Add a release note about multi{map, set}::find not returning the first element anymore (PR #155252)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 25 22:59:54 PDT 2025
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/155252
>From a413e7b6a468c820d4cf85fc87bebff97b9f78e2 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 25 Aug 2025 16:46:22 +0200
Subject: [PATCH 1/2] [libc++] Add a release note about multi{map,set}::find
not returning the first element anymore
---
libcxx/docs/ReleaseNotes/22.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libcxx/docs/ReleaseNotes/22.rst b/libcxx/docs/ReleaseNotes/22.rst
index a26c5476d421b..6be269cfbbc84 100644
--- a/libcxx/docs/ReleaseNotes/22.rst
+++ b/libcxx/docs/ReleaseNotes/22.rst
@@ -61,6 +61,10 @@ Deprecations and Removals
Potentially breaking changes
----------------------------
+- The algorithm for ``multi{map,set}::find`` has been modified, which doesn't guarantee that the first element is
+ returned. If code relies on the first element being returned from ``find`` it may be broken. To fix it use
+ ``lower_bound`` or ``equal_range`` instead.
+
Announcements About Future Releases
-----------------------------------
>From 8b79eb0f617d0bf2c5a85879363c5bcb36b26c31 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Tue, 26 Aug 2025 07:59:47 +0200
Subject: [PATCH 2/2] Update libcxx/docs/ReleaseNotes/22.rst
Co-authored-by: Louis Dionne <ldionne.2 at gmail.com>
---
libcxx/docs/ReleaseNotes/22.rst | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libcxx/docs/ReleaseNotes/22.rst b/libcxx/docs/ReleaseNotes/22.rst
index 6be269cfbbc84..0f46d3e1b2090 100644
--- a/libcxx/docs/ReleaseNotes/22.rst
+++ b/libcxx/docs/ReleaseNotes/22.rst
@@ -61,9 +61,7 @@ Deprecations and Removals
Potentially breaking changes
----------------------------
-- The algorithm for ``multi{map,set}::find`` has been modified, which doesn't guarantee that the first element is
- returned. If code relies on the first element being returned from ``find`` it may be broken. To fix it use
- ``lower_bound`` or ``equal_range`` instead.
+- The algorithm for ``multi{map,set}::find`` has been modified such that it doesn't necessarily return an iterator to the first equal element in the container. This was never guaranteed by the Standard, but libc++ previously happened to always return the first equal element, like other implementations do. Starting with this release, code relying on the first element being returned from ``find`` will be broken, and ``lower_bound`` or ``equal_range`` should be used instead.
Announcements About Future Releases
-----------------------------------
More information about the libcxx-commits
mailing list