aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/SkTArray.h
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-03-04 13:53:22 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-04 13:53:22 -0800
commit91fcb3ed58845ddd5afa98a7150f3024d87c7425 (patch)
tree8fc901cfd4729792c7282683e2ade2db5195e291 /include/private/SkTArray.h
parent41dc3d63a587b6bf4e437ac114485e62c42abe41 (diff)
SkPDF: PDFDevice use SkTArray<T> rather than SkTDArray<T*>
Diffstat (limited to 'include/private/SkTArray.h')
-rw-r--r--include/private/SkTArray.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/private/SkTArray.h b/include/private/SkTArray.h
index 5330e49307..8577200770 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) {