mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 06:51:01 +01:00
[open-type] Add faster range-based loop to array types
This commit is contained in:
1 parent
dc82334061
commit
7129b79406
2 files changed
+13
-1
No files matched your search
@@ -646,6 +646,10 @@ struct ArrayOf
|
||||
operator iter_t () const { return iter (); }
|
||||
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>
|
||||
Type &lsearch (const T &x, Type ¬_found = Crap (Type))
|
||||
{ return *as_array ().lsearch (x, ¬_found); }
|
||||
@@ -819,6 +823,10 @@ struct HeadlessArrayOf
|
||||
operator iter_t () const { return iter (); }
|
||||
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)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
@@ -935,6 +943,10 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
|
||||
operator iter_t () const { return iter (); }
|
||||
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)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ struct hb_vector_t
|
||||
operator iter_t () const { return iter (); }
|
||||
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 *end () const { return arrayZ + length; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user