[Solved] How can I print all the values in this linked list inside a hash table?


im quite confused what you are doing oO

Is that what you are searching for?

std::unorderd_map<std::string, std::list<std::string>> hash_map;

// fill map
....

// go to hash
std::string hash = "whatever";
std::unorderd_map<std::string, std::list<std::string>>::iterator itr;
itr = hash_map.find(hash);

// check if value exists
if(itr == hash_map.end())
   std::cout << "not in map ... " << std::endl;
else {
   // print everything
   const std::list<std::string> & hash_list = (*itr).second;
   for(const std::string & value : hash_list)
      std::cout << value << std::endl;

   // sry edit of course the delete
   hash_map.erase(itr);
}

4

solved How can I print all the values in this linked list inside a hash table?