Add initial draft of heterogeneous erase()

This commit is contained in:
LeonineKing1199
2021-12-02 15:59:12 -08:00
parent f252480bee
commit 33f84624ec
2 changed files with 45 additions and 0 deletions
+30
View File
@@ -515,6 +515,36 @@ template <class UnorderedMap> void test_non_transparent_equal_range()
}
}
template <class UnorderedMap> void test_transparent_erase()
{
count_reset();
UnorderedMap map;
int num_erased = 0;
num_erased = map.erase(0);
BOOST_TEST(map.empty());
BOOST_TEST(num_erased == 0);
BOOST_TEST(key::count_ == 0);
map[key(0)] = 1337;
map[key(1)] = 1338;
map[key(2)] = 1339;
int const expected_key_count = 2 * map.size();
BOOST_TEST(key::count_ == expected_key_count);
num_erased = map.erase(0);
BOOST_TEST(num_erased == 1);
num_erased = map.erase(1337);
BOOST_TEST(num_erased == 0);
BOOST_TEST(key::count_ == expected_key_count);
}
UNORDERED_AUTO_TEST (unordered_map_transparent_count) {
{
typedef boost::unordered_map<key, int, transparent_hasher,