Assert that item-type of arrays have static size
This commit is contained in:
parent
690d9eb83d
commit
bb2a206508
|
@ -562,6 +562,8 @@ struct hb_bytes_t
|
|||
template <typename Type>
|
||||
struct hb_array_t
|
||||
{
|
||||
static_assert ((bool) (unsigned) hb_static_size (Type), "");
|
||||
|
||||
inline hb_array_t (void) : arrayZ (nullptr), len (0) {}
|
||||
inline hb_array_t (Type *array_, unsigned int len_) : arrayZ (array_), len (len_) {}
|
||||
|
||||
|
|
|
@ -345,6 +345,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 };
|
||||
|
||||
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
|
||||
|
@ -449,6 +451,8 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf<Type, OffsetType, has_null>
|
|||
template <typename Type, typename LenType=HBUINT16>
|
||||
struct ArrayOf
|
||||
{
|
||||
static_assert ((bool) (unsigned) hb_static_size (Type), "");
|
||||
|
||||
enum { item_size = Type::static_size };
|
||||
|
||||
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2 (ArrayOf, Type, LenType);
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
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) };
|
||||
|
||||
|
|
Loading…
Reference in New Issue