37 lines
883 B
C++
37 lines
883 B
C++
#include "Map.hpp"
|
|
#include <iostream>
|
|
#include <random>
|
|
#include <sstream>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
int main(void) {
|
|
cs440::Map<int, std::string> a;
|
|
auto rng = std::mt19937{std::random_device{}()};
|
|
for (std::size_t asdf = 0; asdf < 1000000; asdf++) {
|
|
std::vector<int> nums{};
|
|
for (int i = 0; i < 10; i++) {
|
|
int x = rng();
|
|
nums.push_back(x);
|
|
std::stringstream ss;
|
|
ss << x;
|
|
std::string s;
|
|
ss >> s;
|
|
a[x] = s;
|
|
}
|
|
std::cerr << "inserted" << std::endl;
|
|
for (auto &[key, val] : a) {
|
|
std::cout << "key:" << key << "\t" << "value:" << val << std::endl;
|
|
}
|
|
std::cerr << "printed" << std::endl;
|
|
|
|
auto iter = a.begin();
|
|
while (iter != a.end()) {
|
|
auto tmp = iter;
|
|
auto b = a.size();
|
|
++iter;
|
|
a.erase(tmp);
|
|
}
|
|
std::cerr << "erased" << std::endl;
|
|
}
|
|
return 0;
|
|
}
|