diff options
author | 2015-09-23 12:45:49 -0700 | |
---|---|---|
committer | 2015-09-23 12:45:49 -0700 | |
commit | f12a1673f024d30d30f06b9f88b5cc072b8a2d1e (patch) | |
tree | 8b8e41c3737a7041534da2ab78f34f1ae0c35b0d /include/core/SkTArray.h | |
parent | ab26a9b427ec7c525ccd0025f19f0c91b74d8f6d (diff) |
SkPDF: add basic metadata support
Motivation: I want too finalize this API before working on the more
complex problem of adding XMP metadata for PDF/A.
BUG=skia:3110
Review URL: https://codereview.chromium.org/1359943003
Diffstat (limited to 'include/core/SkTArray.h')
-rw-r--r-- | include/core/SkTArray.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/core/SkTArray.h b/include/core/SkTArray.h index d67956be32..401f7084d6 100644 --- a/include/core/SkTArray.h +++ b/include/core/SkTArray.h @@ -194,6 +194,14 @@ public: } /** + * Construct a new T at the back of this array. + */ + template<class... Args> T& emplace_back(Args&&... args) { + T* newT = reinterpret_cast<T*>(this->push_back_raw(1)); + return *new (newT) T(skstd::forward<Args>(args)...); + } + + /** * Allocates n more default-initialized T values, and returns the address of * the start of that new range. Note: this address is only valid until the * next API call made on the array that might add or remove elements. |