The problem: I want to be able to FIFO queue outgoing messages. For update/deletion reasons, I also want to be able to access every message in the queue based upon an object ID.
I’ve currently implemented a solution where data is pushed into a deque, and an iterator to that data is kept. The iterator, keyed by an object ID, is then placed into a map. This was fine in the one place that I did it, but I now find myself wanting to do this elsewhere.
Am I over-complicating the problem? Is there a data structure out there that does this already?
Why not make the deque a deque of IDs and the map a map from ID to object. Then when you access an ID in the deque, you look up the ID in the map. If the IDs are globally unique, you only need one map to service all the deques.