[arrays] Minor
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 17 Dec 2018 01:35:11 +0000 (20:35 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 17 Dec 2018 03:31:13 +0000 (22:31 -0500)
src/hb-array.hh
src/hb-open-type.hh
src/hb-vector.hh

index fd3bd44..2fc50ed 100644 (file)
@@ -69,7 +69,8 @@ struct hb_sorted_array_t;
 template <typename Type>
 struct hb_array_t
 {
-  static_assert ((bool) (unsigned) hb_static_size (Type), "");
+  typedef Type ItemType;
+  enum { item_size = hb_static_size (Type) };
 
   hb_array_t (void) : arrayZ (nullptr), len (0) {}
   hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {}
index e4f4eb9..67962ee 100644 (file)
@@ -352,9 +352,8 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType, has_null>
 template <typename Type>
 struct UnsizedArrayOf
 {
-  static_assert ((bool) (unsigned) hb_static_size (Type), "");
-
-  enum { item_size = Type::static_size };
+  typedef Type ItemType;
+  enum { item_size = hb_static_size (Type) };
 
   HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
 
@@ -509,9 +508,8 @@ struct SortedUnsizedArrayOf : UnsizedArrayOf<Type>
 template <typename Type, typename LenType=HBUINT16>
 struct ArrayOf
 {
-  static_assert ((bool) (unsigned) hb_static_size (Type), "");
-
-  enum { item_size = Type::static_size };
+  typedef Type ItemType;
+  enum { item_size = hb_static_size (Type) };
 
   HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType);
 
index cc45be2..6016104 100644 (file)
 template <typename Type, unsigned int PreallocedCount=8>
 struct hb_vector_t
 {
-  static_assert ((bool) (unsigned) hb_static_size (Type), "");
-
   typedef Type ItemType;
-  enum { item_size = sizeof (Type) };
+  enum { item_size = hb_static_size (Type) };
 
   HB_NO_COPY_ASSIGN_TEMPLATE2 (hb_vector_t, Type, PreallocedCount);
   hb_vector_t (void) { init (); }