std::multimap::find() is not guaranteed to return the first entry with the

requested key. Any may be returned if many exist.

A newer libc++ optimizes the multimap::find() and the first entry is no longer
returned.

PiperOrigin-RevId: 799621859
Change-Id: Ia17f0ff90f720791be563ffb32dc852fe74cdcf1
This commit is contained in:
Bogdan Graur
2025-08-26 10:34:17 -07:00
committed by Copybara-Service
parent e12f5e9bb4
commit 87ac7db2f2

View File

@@ -216,7 +216,7 @@ TEST(Split, APIExamples) {
std::multimap<std::string, std::string> m =
absl::StrSplit("a,1,b,2,a,3", ',');
EXPECT_EQ(3, m.size());
auto it = m.find("a");
auto it = m.lower_bound("a");
EXPECT_EQ("1", it->second);
++it;
EXPECT_EQ("3", it->second);