q: std::multimap<std::string, std::string> ... if two keys are equivalent for two pieces of data, does C++ guarantee that inserting item a before item b will always retrieve item a before item b?
Printable View
q: std::multimap<std::string, std::string> ... if two keys are equivalent for two pieces of data, does C++ guarantee that inserting item a before item b will always retrieve item a before item b?
I doubt the standard specifies anything other than the elements can be inserted/retrieved in a certain amount of time. If you require a specific order you need to consider a list or a vector. You can, however, influence the ordering of maps/sets/multi-maps, etc. by specifying the sort algorithm or by (I believe) overloading the less than (<) operator.
>does C++ guarantee that inserting item a before item b will always retrieve item a before item b?
No, the order of duplicate items is unspecified.