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

Unified Diff: cc/base/list_container.h

Issue 1199343004: Add ListContainer::swap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor test for clarity Created 5 years, 6 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
« no previous file with comments | « no previous file | cc/base/list_container_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/list_container.h
diff --git a/cc/base/list_container.h b/cc/base/list_container.h
index 5463ca2066873bef445acb6a66bcbf084db2bb37..a9444cd03aa08d1e1192e625198e8222dae0ce36 100644
--- a/cc/base/list_container.h
+++ b/cc/base/list_container.h
@@ -288,6 +288,11 @@ class ListContainer : public ListContainerBase {
return new (*at) DerivedElementType();
}
+ template <typename DerivedElementType>
+ void swap(ListContainer<DerivedElementType>& other) {
+ data_.swap(other.data_);
+ }
+
// Appends a new item without copying. The original item will not be
// destructed and will be replaced with a new DerivedElementType. The
// DerivedElementType does not have to match the moved type as a full block
« no previous file with comments | « no previous file | cc/base/list_container_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698