C++ Vector /优先级队列列表?

cyr*_*rux 2 c++ stl list vector priority-queue

为什么C++不允许这样的东西呢?

我需要有多个优先级队列,其数量将在运行时确定.

这无法编译

std::vector<std::priorityqueue<Class A>>.

有更好的方法吗?

Jam*_*lis 6

The correct code would be:

std::vector<std::priority_queue<A> >
Run Code Online (Sandbox Code Playgroud)

Note that Class does not belong next to A, priority_queue has an underscore in it, and there is a space required between the two right angle brackets (>> is parsed as a right shift operator).

这也要求A低于可比性(如果不是,则必须提供优先级队列使用的比较函数).