template <typename Type>
struct Supplier
{
- Supplier (const Type *array, unsigned int len_, unsigned int stride_=sizeof (Type))
+ Supplier (const Type *array, unsigned int len_)
{
head = array;
len = len_;
- stride = stride_;
}
Supplier (hb_array_t<const Type> v)
{
head = v.arrayZ;
len = v.len;
- stride = sizeof (Type);
}
Supplier (const hb_vector_t<Type> &v)
{
head = (const Type *) v;
len = v.len;
- stride = sizeof (Type);
}
const Type operator [] (unsigned int i) const
{
if (unlikely (i >= len)) return Type ();
- return * (const Type *) (const void *) ((const char *) head + stride * i);
+ return head[i];
}
Supplier<Type> & operator += (unsigned int count)
if (unlikely (count > len))
count = len;
len -= count;
- head = (const Type *) (const void *) ((const char *) head + stride * count);
+ head += count;
return *this;
}
Supplier<Type>& operator= (const Supplier<Type> &); /* Disallow copy */
unsigned int len;
- unsigned int stride;
const Type *head;
};