Does std::multiset guarantee insertion order?

Posted by Naveen on Stack Overflow See other posts from Stack Overflow or by Naveen
Published on 2010-04-15T07:40:52Z Indexed on 2010/04/15 8:13 UTC
Read the original article Hit count: 212

I have a std::multiset which stores elements of class A. I have provided my own implementation of operator< for this class. My question is if I insert two equivalent objects into this multiset is their order guaranteed? For example, first I insert a object a1 into the set and then I insert an equivalent object a2 into this set. Can I expect the a1 to come before a2 when I iterate through the set? If no, is there any way to achieve this using multiset?

© Stack Overflow or respective owner

Related posts about c++

Related posts about stl