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?
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?
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
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.
Free code: http://sol-biotech.com/code/.
It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
--Me, I just made it up
The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
--George Bernard Shaw
>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.
My best code is written with the delete key.