I wanted to maintain the input order while inserting data to a multimap.
my key is a int , and
value is struct.
but when i print the data using an iterator they come out in a sorted fashion, as it maintains the data in a balanced binary tree and traversed inorder.
You could use a more complex key that stores both the actual key, and an ordinal value. Then write the comparison function so that it compares only the ordinal.
Note that this approach doesn't require a multimap, even if a key is inserted more than once.