this question has answer here:
- how merge 2 priority_queue? 1 answer
std::priority_queue<some_type, std::vector<some_type>, some_comparator> a; std::priority_queue<some_type, std::vector<some_type>, some_comparator> b; how can merge these priority queues , b based on same comparator. tried find builtin function not find any.
the simplest way move objects 1 queue another:
while(!b.empty()) { a.push(b.top()); b.pop(); } there might exist more efficient method, though.
Comments
Post a Comment