Hi,

I have a QPtrList<myClass> which is a queue.
Each element of myClass has an id.

Given the id of an element in the queue, I need to remove such element from the QPtrList in the most efficient way.

In order to do this, I would like to use a map for ids of elements in the queue, and associate something to each id in the map, such that allows me to efficiently find the element in the queue and delete it ( ideally with complexity O(1) ).

These are the information I thought I can associate to each id in the map in order to remove such element from the queue:

- the Pointer "p" (reference) to the element in the queue (I would need to use the removeRef(p) function of the QPtrList)
or
- the index "i" of the element in the queue (I would need to use the remove(i) function of the QPtrList)

Does anyone know which function is the most efficient between the removeRef(p) or the remove(i) of the QPtrList class?

Is it possible to use some other information (i.e. a QPtrListIterator) to delete an element from the QPtrList in a more efficient way?

Thanks in advance for your help!