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

Unified Diff: include/private/SkTArray.h

Issue 1767713002: SkPDF: PDFDevice use SkTArray<T> rather than SkTDArray<T*> (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-04 (Friday) 16:33:27 EST Created 4 years, 10 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 | src/pdf/SkPDFDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/SkTArray.h
diff --git a/include/private/SkTArray.h b/include/private/SkTArray.h
index 5330e4930725cf5bbf5945e66cf847da68d09fba..8577200770dbcf43eb6cc0dbf2f48f97d8cb1876 100644
--- a/include/private/SkTArray.h
+++ b/include/private/SkTArray.h
@@ -156,6 +156,15 @@ public:
}
/**
+ * Version of above that uses a move constructor to initialize the new item
+ */
+ T& push_back(T&& t) {
+ T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
+ new (newT) T(std::move(t));
+ return *newT;
+ }
+
+ /**
* Construct a new T at the back of this array.
*/
template<class... Args> T& emplace_back(Args&&... args) {
« no previous file with comments | « no previous file | src/pdf/SkPDFDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698