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

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: 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..aa8a6f948a067df6f63a964632286afbae04c012 100644
--- a/base/stl_util.h
+++ b/base/stl_util.h
@@ -257,6 +257,15 @@ bool STLIncludes(const Arg1& a1, const Arg2& a2) {
a2.begin(), a2.end());
}
+template <typename PriorityQueue>
+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