I need to erase elements from an std::map based on the time of insertion (or something else more efficient than that).
The map will probably hold thousands of elements a
You can use a queue, and insert pointers to objects as they are inserted into the map. The next item in the queue will be the oldest one. Or you can store a pair in the queue if you also need the time of insertion.