adding benchmarks and readme

This commit is contained in:
Jidong Xiao
2025-03-11 00:56:33 -04:00
committed by JamesFlare1212
parent 186a7e60ea
commit 95d9bb50ca
5 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#include <iostream>
#include <map>
int main() {
const int N = 1000000;
std::map<int, int> m;
// fill the map with some values
for (int i = 0; i < N; ++i) {
m[i] = i;
}
// erase all elements using iterators
for (std::map<int, int>::iterator itr = m.begin(); itr != m.end(); ) {
itr = m.erase(itr); // erase using iterator and move to the next element
}
return 0;
}