fogleman / hmm

Heightmap meshing utility.
MIT License
571 stars 50 forks source link

Homebrew priority queue -> std::set? #9

Open Komzpa opened 5 years ago

Komzpa commented 5 years ago

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