I have some data which come with a integer index. I am continuous generating new data which needs to added to the collection of data I have, sorted by that index, at the sa
Unless I've missed something, the standard doesn't provide any such guarantee.
The most obvious workaround would be to include a sequence number as a secondary key. For example, in your class include a static unsigned long, and each time you create an object to insert in the multimap, put its current value into your object, and increment it. In your object's comparison function, use that counter as the deciding factor for ordering if the data you're currently using as the key compares equal. Note that in this case, each key will be unique, so you can use a map instead of a multimap.