I am using Boost unordered_map. I have a key value pair for each entry. How could I determine whether a particular value exist in the map? (I don\'t want to create another u
Why can't we use count method instead of find()
Description: Count elements with a specific key Searches the container for elements whose key is k and returns the number of elements found. Because unordered_map containers do not allow for duplicate keys, this means that the function actually returns 1 if an element with that key exists in the container, and zero otherwise.
unordered_map hash;
//converted array into hashMap
for(int i=0; i<6; i++)
{
hash[i];
}
//commom elemenest value is set to 1 in hashMap
for(int i =0; i<7; i++)
{
//element exist in array1
if(hash.count(i))
{
hash[i] = 1;
}
}