Add with_submap api for parallel maps allowing access to submaps under lock protection

This commit is contained in:
greg7mdp
2022-07-25 21:37:43 -04:00
parent f71777d540
commit d24c47fdce
3 changed files with 56 additions and 26 deletions
+11
View File
@@ -116,6 +116,17 @@ TEST(THIS_TEST_NAME, ForEach) {
EXPECT_EQ(pair.first + 7, pair.second);
});
EXPECT_EQ(counter, 3);
counter = 0;
for (size_t i=0; i<m.subcnt(); ++i) {
m.with_submap(i, [&](const Map::EmbeddedSet& set) {
for (auto& p : set) {
++counter;
EXPECT_EQ(p.first + 7, p.second);
}
});
}
EXPECT_EQ(counter, 3);
}
TEST(THIS_TEST_NAME, EmplaceSingle) {