[array] Add truncate() method
This commit is contained in:
parent
a06edf1430
commit
d58e248df6
|
@ -181,6 +181,8 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||||
hb_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const
|
hb_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const
|
||||||
{ return sub_array (start_offset, &seg_count); }
|
{ return sub_array (start_offset, &seg_count); }
|
||||||
|
|
||||||
|
hb_array_t truncate (unsigned length) const { return sub_array (0, length); }
|
||||||
|
|
||||||
template <typename T,
|
template <typename T,
|
||||||
unsigned P = sizeof (Type),
|
unsigned P = sizeof (Type),
|
||||||
hb_enable_if (P == 1)>
|
hb_enable_if (P == 1)>
|
||||||
|
@ -263,6 +265,8 @@ struct hb_sorted_array_t :
|
||||||
hb_sorted_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const
|
hb_sorted_array_t sub_array (unsigned int start_offset, unsigned int seg_count) const
|
||||||
{ return sub_array (start_offset, &seg_count); }
|
{ return sub_array (start_offset, &seg_count); }
|
||||||
|
|
||||||
|
hb_sorted_array_t truncate (unsigned length) const { return sub_array (0, length); }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Type *bsearch (const T &x, Type *not_found = nullptr)
|
Type *bsearch (const T &x, Type *not_found = nullptr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue