diff options
author | Florin Malita <fmalita@chromium.org> | 2017-03-09 12:17:15 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-09 18:21:09 +0000 |
commit | b1d800dc228df12b31213dc1968bcd8680ec2d0e (patch) | |
tree | 8a1bad524cefa41f4daeb86099fa886f8e6f9080 /include/private/SkTArray.h | |
parent | 6e93584e840fc769e804170aadf64177760ab569 (diff) |
SkSTArray move ctor
Change-Id: Ice90a229e1ca5959b365c678e8df332cd6ed4a03
Reviewed-on: https://skia-review.googlesource.com/9489
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'include/private/SkTArray.h')
-rw-r--r-- | include/private/SkTArray.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/private/SkTArray.h b/include/private/SkTArray.h index 1c06bf331a..bd0798ce76 100644 --- a/include/private/SkTArray.h +++ b/include/private/SkTArray.h @@ -403,6 +403,18 @@ protected: } /** + * Move another array, using preallocated storage if preAllocCount >= + * array.count(). Otherwise storage will only be used when array shrinks + * to fit. + */ + template <int N> + SkTArray(SkTArray&& array, SkAlignedSTStorage<N,T>* storage) { + this->init(array.fCount, storage->get(), N); + array.move(fMemArray); + array.fCount = 0; + } + + /** * Copy a C array, using preallocated storage if preAllocCount >= * count. Otherwise storage will only be used when array shrinks * to fit. @@ -532,10 +544,18 @@ public: : INHERITED(array, &fStorage) { } + SkSTArray(SkSTArray&& array) + : INHERITED(std::move(array), &fStorage) { + } + explicit SkSTArray(const INHERITED& array) : INHERITED(array, &fStorage) { } + explicit SkSTArray(INHERITED&& array) + : INHERITED(std::move(array), &fStorage) { + } + explicit SkSTArray(int reserveCount) : INHERITED(reserveCount) { } |