我想要一个最小优先级队列,而不是包含整数,而是存储数组。每个元素的优先级是数组中的第一个元素。
priority_queue<array<int, 6>, vector<int>, greater<int>> pq;
array<int, 6> arr = {a, b, c, d, e, f};
pq.push(arr);
array<int, 6> popArr = pq.pop();
当我这样做时,出现以下与推送有关的错误:
no matching function for call to ‘std::priority_queue<std::array<int, 6>, std::vector<int>, std::greater<int> >::push(std::array<int, 6>&)’
pq.push(arr);
与以下有关的弹出:
conversion from ‘void’ to non-scalar type ‘std::array<int, 6>’ requested
array<int, 6> popArr = pq.pop();
如何解决这些错误?