Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: base/stl_util.h

Issue 1886453003: Make PendingTask move-only and pass it by value on retaining params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable WorkQueue copy Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698