Merge "Adds hidl_array<T, SIZE1, SIZE...>::size() API"
diff --git a/include/hidl/HidlSupport.h b/include/hidl/HidlSupport.h
index e2495e3..e4409e4 100644
--- a/include/hidl/HidlSupport.h
+++ b/include/hidl/HidlSupport.h
@@ -21,6 +21,7 @@
#include <dirent.h>
#include <dlfcn.h>
#include <hwbinder/Parcel.h>
+#include <tuple>
#include <utils/Errors.h>
#include <utils/RefBase.h>
#include <utils/StrongPointer.h>
@@ -258,6 +259,12 @@
&mBuffer[index * details::product<SIZES...>::value]);
}
+ using size_tuple_type = std::tuple<decltype(SIZE1), decltype(SIZES)...>;
+
+ static constexpr size_tuple_type size() {
+ return std::make_tuple(SIZE1, SIZES...);
+ }
+
private:
T mBuffer[details::product<SIZE1, SIZES...>::value];
};
@@ -277,6 +284,8 @@
return mBuffer[index];
}
+ static constexpr size_t size() { return SIZE1; }
+
private:
T mBuffer[SIZE1];
};