提交 3656f56d 编写于 作者: B Behdad Esfahbod

[arrays] Minor

上级 aa8f9471
...@@ -69,7 +69,8 @@ struct hb_sorted_array_t; ...@@ -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) {}
......
...@@ -352,9 +352,8 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType, has_null> ...@@ -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> ...@@ -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);
......
...@@ -34,10 +34,8 @@ ...@@ -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 (); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册