[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 07:49:10 PDT 2025


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/155252

We've modified the algorithm of `__tree::find` in #152370, which can change the return value. Since we're always returned the lower bound before some users started relying on it. This patch adds a release note so users are aware that this might break their code.



>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] [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
 -----------------------------------
 



More information about the libcxx-commits mailing list