I don't see a way to map multiple values to one key in a boost::unordered_map
. My map is declared as:
boost::unordered_map< uint16_t, Myclass* > myMap_;
I think I could achieve this by storing objects of MyClass in containers, i.e:
boost::unordered_map< uint16_t, vector<Myclass*> > myMap_;
however unordered_map provides the meanings to manage load factor size, therefore I wonder if it really can't or maybe it can somehow tie multiple values into a single key?
float max_load_factor() const;
Returns: Returns the current maximum load factor.
void max_load_factor(float z);
Effects: Changes the container's maximum load factor, using z as a hint.
size_type bucket_size(size_type n) const;
Requires: n < bucket_count()
Returns: The number of elements in bucket n.
I know I can use multimap
typedef boost::unordered_multimap< int, MyClass*, MyHash<int> > HashMMap;
however I wondered if multiple values for a single key are possible somehow with a use of unordered_map.