[open-type] Add faster range-based loop to array types
This commit is contained in:
parent
dc82334061
commit
7129b79406
|
@ -646,6 +646,10 @@ struct ArrayOf
|
||||||
operator iter_t () const { return iter (); }
|
operator iter_t () const { return iter (); }
|
||||||
operator writer_t () { return writer (); }
|
operator writer_t () { return writer (); }
|
||||||
|
|
||||||
|
/* Faster range-based for loop. */
|
||||||
|
const Type *begin () const { return arrayZ; }
|
||||||
|
const Type *end () const { return arrayZ + len; }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Type &lsearch (const T &x, Type ¬_found = Crap (Type))
|
Type &lsearch (const T &x, Type ¬_found = Crap (Type))
|
||||||
{ return *as_array ().lsearch (x, ¬_found); }
|
{ return *as_array ().lsearch (x, ¬_found); }
|
||||||
|
@ -819,6 +823,10 @@ struct HeadlessArrayOf
|
||||||
operator iter_t () const { return iter (); }
|
operator iter_t () const { return iter (); }
|
||||||
operator writer_t () { return writer (); }
|
operator writer_t () { return writer (); }
|
||||||
|
|
||||||
|
/* Faster range-based for loop. */
|
||||||
|
const Type *begin () const { return arrayZ; }
|
||||||
|
const Type *end () const { return arrayZ + get_length (); }
|
||||||
|
|
||||||
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
|
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
@ -935,6 +943,10 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
|
||||||
operator iter_t () const { return iter (); }
|
operator iter_t () const { return iter (); }
|
||||||
operator writer_t () { return writer (); }
|
operator writer_t () { return writer (); }
|
||||||
|
|
||||||
|
/* Faster range-based for loop. */
|
||||||
|
const Type *begin () const { return this->arrayZ; }
|
||||||
|
const Type *end () const { return this->arrayZ + this->len; }
|
||||||
|
|
||||||
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
|
bool serialize (hb_serialize_context_t *c, unsigned int items_len)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
|
|
@ -172,7 +172,7 @@ struct hb_vector_t
|
||||||
operator iter_t () const { return iter (); }
|
operator iter_t () const { return iter (); }
|
||||||
operator writer_t () { return writer (); }
|
operator writer_t () { return writer (); }
|
||||||
|
|
||||||
/* Faster range-based for loop without constructing an hb_array_t. */
|
/* Faster range-based for loop. */
|
||||||
Type *begin () const { return arrayZ; }
|
Type *begin () const { return arrayZ; }
|
||||||
Type *end () const { return arrayZ + length; }
|
Type *end () const { return arrayZ + length; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue