Chromium Code Reviews| Index: base/stl_util.h |
| diff --git a/base/stl_util.h b/base/stl_util.h |
| index 12e226a9db9b106b95f9500efe684463d1ecd1f2..352344eeff94b046a26f54e6a5ec72343e10d59b 100644 |
| --- a/base/stl_util.h |
| +++ b/base/stl_util.h |
| @@ -257,6 +257,16 @@ bool STLIncludes(const Arg1& a1, const Arg2& a2) { |
| a2.begin(), a2.end()); |
| } |
| +// Moves out and removes the top element of a std::priority_queue. |
| +template <typename PriorityQueue> |
|
Nico
2016/04/22 15:32:16
this is only called from two places. the loop is i
tzik
2016/04/25 11:36:26
Hmm, there are several user of the pattern. And I
|
| +typename PriorityQueue::value_type |
| +PopOutFromPriorityQueue(PriorityQueue* queue) { |
| + using ValueType = typename PriorityQueue::value_type; |
| + ValueType ret = std::move(const_cast<ValueType&>(queue->top())); |
| + queue->pop(); |
| + return ret; |
| +} |
| + |
| } // namespace base |
| #endif // BASE_STL_UTIL_H_ |