提交 507cac49 编写于 作者: B Behdad Esfahbod

[arrays] Start moving Supplier<> to hb_array_t<>

上级 1e2c9812
......@@ -642,45 +642,36 @@ struct hb_serialize_context_t
*/
template <typename Type>
struct Supplier
struct Supplier : hb_array_t<const Type>
{
Supplier (const Type *array, unsigned int len_)
{
head = array;
len = len_;
this->arrayZ = array;
this->len = len_;
}
Supplier (hb_array_t<const Type> v)
{
head = v.arrayZ;
len = v.len;
this->arrayZ = v.arrayZ;
this->len = v.len;
}
Supplier (const hb_vector_t<Type> &v)
{
head = (const Type *) v;
len = v.len;
}
const Type operator [] (unsigned int i) const
{
if (unlikely (i >= len)) return Type ();
return head[i];
this->arrayZ = (const Type *) v;
this->len = v.len;
}
Supplier<Type> & operator += (unsigned int count)
{
if (unlikely (count > len))
count = len;
len -= count;
head += count;
if (unlikely (count > this->len))
count = this->len;
this->len -= count;
this->arrayZ += count;
return *this;
}
private:
Supplier (const Supplier<Type> &); /* Disallow copy */
Supplier<Type>& operator= (const Supplier<Type> &); /* Disallow copy */
unsigned int len;
const Type *head;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册