Implementing a priority queue that can be iterated over in C++

后端 未结 4 1478
暗喜
暗喜 2021-02-10 07:23

I need to implement a priority queue for a project, but the STL\'s priority_queue is not indicated since we need to iterate over all elements and remove them random

4条回答
  •  庸人自扰
    2021-02-10 07:58

    I would follow the example set by some of the other container adapters in the standard library use composition and make the type of the underlying container a template parameter. Though since it is a school project that might be too much flexibility. You might start by using composition with one of the existing Containers and build from there if necessary.

提交回复
热议问题