diff --git a/include/private/SkTArray.h b/include/private/SkTArray.h index 5094a2c3b8..2f1ed71ea8 100644 --- a/include/private/SkTArray.h +++ b/include/private/SkTArray.h @@ -628,40 +628,41 @@ template constexpr int SkTArray::kMinHea * Subclass of SkTArray that contains a preallocated memory block for the array. */ template -class SkSTArray : public SkTArray { +class SkSTArray : private SkAlignedSTStorage, public SkTArray { private: + using STORAGE = SkAlignedSTStorage; using INHERITED = SkTArray; public: - SkSTArray() : INHERITED(&fStorage) { + SkSTArray() : STORAGE{}, INHERITED(static_cast(this)) { } SkSTArray(const SkSTArray& array) - : INHERITED(array, &fStorage) { + : STORAGE{}, INHERITED(array, static_cast(this)) { } SkSTArray(SkSTArray&& array) - : INHERITED(std::move(array), &fStorage) { + : STORAGE{}, INHERITED(std::move(array), static_cast(this)) { } explicit SkSTArray(const INHERITED& array) - : INHERITED(array, &fStorage) { + : STORAGE{}, INHERITED(array, static_cast(this)) { } explicit SkSTArray(INHERITED&& array) - : INHERITED(std::move(array), &fStorage) { + : STORAGE{}, INHERITED(std::move(array), static_cast(this)) { } explicit SkSTArray(int reserveCount) - : INHERITED(reserveCount) { + : STORAGE{}, INHERITED(reserveCount) { } SkSTArray(const T* array, int count) - : INHERITED(array, count, &fStorage) { + : STORAGE{}, INHERITED(array, count, static_cast(this)) { } SkSTArray(std::initializer_list data) - : INHERITED(data, &fStorage) { + : STORAGE{}, INHERITED(data, static_cast(this)) { } SkSTArray& operator=(const SkSTArray& array) { @@ -683,9 +684,6 @@ public: INHERITED::operator=(std::move(array)); return *this; } - -private: - SkAlignedSTStorage fStorage; }; #endif