[arrays] Minor

This commit is contained in:
Behdad Esfahbod 2018-12-16 20:35:11 -05:00
parent aa8f94714e
commit 3656f56d47
3 changed files with 7 additions and 10 deletions

View File

@ -69,7 +69,8 @@ struct hb_sorted_array_t;
template <typename Type> template <typename Type>
struct hb_array_t 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 (void) : arrayZ (nullptr), len (0) {}
hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {} hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {}

View File

@ -352,9 +352,8 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType, has_null>
template <typename Type> template <typename Type>
struct UnsizedArrayOf struct UnsizedArrayOf
{ {
static_assert ((bool) (unsigned) hb_static_size (Type), ""); typedef Type ItemType;
enum { item_size = hb_static_size (Type) };
enum { item_size = Type::static_size };
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type); HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
@ -509,9 +508,8 @@ struct SortedUnsizedArrayOf : UnsizedArrayOf<Type>
template <typename Type, typename LenType=HBUINT16> template <typename Type, typename LenType=HBUINT16>
struct ArrayOf struct ArrayOf
{ {
static_assert ((bool) (unsigned) hb_static_size (Type), ""); typedef Type ItemType;
enum { item_size = hb_static_size (Type) };
enum { item_size = Type::static_size };
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType); HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType);

View File

@ -34,10 +34,8 @@
template <typename Type, unsigned int PreallocedCount=8> template <typename Type, unsigned int PreallocedCount=8>
struct hb_vector_t struct hb_vector_t
{ {
static_assert ((bool) (unsigned) hb_static_size (Type), "");
typedef Type ItemType; 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_NO_COPY_ASSIGN_TEMPLATE2 (hb_vector_t, Type, PreallocedCount);
hb_vector_t (void) { init (); } hb_vector_t (void) { init (); }