tags:

views:

73

answers:

1

What is the most efficient way to count all the different keys in a hash_multimap?

E.g. if I have a already filled hash_multimap, (e.g. a container where you can store multiple entities with a same key) how can i retrieve the set of keys?

+1  A: 

Insert the keys into a std::set and find the size of the set.

Naveen
Or a `hash_set`, given that for some reason a hash has previously been preferred to a tree for this data.
Steve Jessop