I am wondering whether this is true? If it is, is this behavior guaranteed by the c++ standard?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The elements in a
std::mapmust have unique keys, so… no.The
std::multimapcontainer allows multiple values mapped to one key. When iterating over astd::multimapthe elements are ordered by key, but the order of elements having the same key is not specified.Note that in the latest draft of the forthcoming C++0x standard (N3092), the relative ordering of elements with the same key is guaranteed (so, at some point, you’ll be able to rely on this behavior).