提交 f85f6e81 编写于 作者: B Behdad Esfahbod

[array] Add operator +=

上级 7c0e3e9b
......@@ -57,6 +57,15 @@ struct hb_array_t
Type * operator & (void) const { return arrayZ; }
hb_array_t<Type> & operator += (unsigned int count)
{
if (unlikely (count > len))
count = len;
len -= count;
arrayZ += count;
return *this;
}
unsigned int get_size (void) const { return len * item_size; }
hb_array_t<Type> sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const
......@@ -241,15 +250,6 @@ struct Supplier : hb_array_t<const Type>
this->len = v.len;
}
Supplier<Type> & operator += (unsigned int 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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册