Remove an element from the middle of an std::heap

后端 未结 6 2050
离开以前
离开以前 2021-02-07 05:17

I\'m using a priority queue as a scheduler with one extra requirement. I need to be able to cancel scheduled items. This equates to removing an item from the middle of the pri

6条回答
  •  时光取名叫无心
    2021-02-07 05:44

    You can try ‘std::multiset’ which is implemented as the heap structure and support ‘std::erase’ operation, so you could ‘std::find’ the element then erase it.

提交回复
热议问题