hmm icon indicating copy to clipboard operation
hmm copied to clipboard

Homebrew priority queue -> std::set?

Open Komzpa opened this issue 6 years ago • 0 comments

I see that std::priority_queue doesn't have the required Remove method. Googling the stackoverflow to learn how people live with that in C++ land got this: people sometimes use std::set for that, if queue can't keep element multiple times. It has erase method to remove something. Underlying structure is then a binary tree instead of heap, allowing faster removal without repacking everything.

Hope this helps, feel free to ignore, any comment why is it bad idea if it is would be appreciated.

https://github.com/fogleman/hmm/blob/0e0fdaa4c88028ba263831f3677eae675b888428/src/triangulator.cpp#L303

Komzpa avatar Oct 05 '19 10:10 Komzpa