Allow hidl_vec initializer to take arbitrary type.
In constructor, std::initializer_list<int> -> std::initializer_list<T>
Test: libhidl_test
Change-Id: I286ad9e2a31cf4dedb7f8b4051379ae5f3849fd0
diff --git a/include/hidl/HidlSupport.h b/include/hidl/HidlSupport.h
index d2a0a8a..4e63613 100644
--- a/include/hidl/HidlSupport.h
+++ b/include/hidl/HidlSupport.h
@@ -129,12 +129,12 @@
*this = std::move(other);
}
- hidl_vec(const std::initializer_list<int> list)
+ hidl_vec(const std::initializer_list<T> list)
: mSize(list.size()),
mOwnsBuffer(true) {
mBuffer = new T[mSize];
- int idx = 0;
+ size_t idx = 0;
for (auto it = list.begin(); it != list.end(); ++it) {
mBuffer[idx++] = *it;
}