Index: include/core/SkTArray.h |
diff --git a/include/core/SkTArray.h b/include/core/SkTArray.h |
index d67956be32906a94cead365f2ecd9c87c52a9aec..401f7084d6e548e0e7931f88031b973549ab735b 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. |