Add initializer support to FatVector
Added constructor to FatVector to support C++ initializer
list usage
Test: Added tests to CanvasOpTest
Change-Id: If28066af1b1d747bab4e01b4d6a563412a11e7ec
diff --git a/libs/ui/include/ui/FatVector.h b/libs/ui/include/ui/FatVector.h
index 25fe3a0..cb61e6a 100644
--- a/libs/ui/include/ui/FatVector.h
+++ b/libs/ui/include/ui/FatVector.h
@@ -82,6 +82,12 @@
this->reserve(SIZE);
}
+ FatVector(std::initializer_list<T> init)
+ : std::vector<T, InlineStdAllocator<T, SIZE>>(init,
+ InlineStdAllocator<T, SIZE>(mAllocation)) {
+ this->reserve(SIZE);
+ }
+
explicit FatVector(size_t capacity) : FatVector() { this->resize(capacity); }
private: