I'm trying to update a key in a nested map if it exists or insert it if it doesn't. I'm trying to use an iterator with lower_bound to make this process efficient.
std::unordered_map<std::string, std::unordered_map<std::string, std::string>> maps; cache::iterator iter(maps[command[1]].lower_bound(command[2])); if (iter == maps[command[1]].end() || command[2] < iter->first) { maps[command[1]].insert(iter, std::make_pair(command[2], command[3])); } else { iter->second = command[3]; } I'm getting the following compile time error: no member named 'lower_bound' in 'std::unordered_map<std::basic_string<char>, std::basic_string<char>, std::hash<std::string>, std::equal_to<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, std::basic_string<char> > > >'
std::unordered_map::lower_bounddoesn't exist! It doesn't make sense to look for a lower bound on a container where the elements aren't sorted.findto see if the element exists?