#include <unordered_map>
#include <iostream>
int main() {
std::unordered_map<int, std::string> m_pluginRenderMap;
std::unordered_map<int, std::string> umap = {{1, "one"}, {2, "two"}, {3, "three"}};
m_pluginRenderMap.insert({1, "one"});
m_pluginRenderMap.emplace(2, "two");
for (auto it = umap.begin(); it != umap.end(); ++it)
{
std::cout << it->first << ": " << it->second << std::endl;
}
umap.erase(2);
for (const auto& pair : umap) {
std::cout << pair.first << ": " << pair.second << std::endl;
}
auto it = umap.find(2);
if (it != umap.end()) {
std::cout << "Found: " << it->first << ": " << it->second << std::endl;
} else {
std::cout << "Not found" << std::endl;
}
std::cout << umap[3] << std::endl;
try {
std::cout << umap.at(4) << std::endl;
} catch (const std::out_of_range& e) {
std::cout << e.what() << std::endl;
}
return 0;
}