Vote count:
0
I have a set which stores a lot (upwards of 50k) of double type values on the heap. I also create a
map<key, list of pointers to elements in the aforementioned set>
Now I would like to erase the elements pointed to by the key in this map. I would use the set::erase function but it only accepts the iterators pointing to the element to be erased. Would I be correct to use delete(pointer) to remove the object from the set? I am quite uncertain of this because set does not use contiguous memory.
Other solutions to my problem would also be highly appreciated. I keep the set sorted in descending order of the values. I require insertion and deletion in O(logN). However, note that deletion is not by value in the set but by some other key.
asked 25 secs ago
Aucun commentaire:
Enregistrer un commentaire