[array] Adjust operator !=

This commit is contained in:
Behdad Esfahbod 2022-07-17 18:44:11 -06:00
parent 9518d602f3
commit b475a2ab29
1 changed files with 4 additions and 3 deletions

View File

@ -100,10 +100,9 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
/* Ouch. The operator== compares the contents of the array. For range-based for loops, /* Ouch. The operator== compares the contents of the array. For range-based for loops,
* it's best if we can just compare arrayZ, though comparing contents is still fast, * it's best if we can just compare arrayZ, though comparing contents is still fast,
* but also would require that Type has operator==. As such, we optimize this operator * but also would require that Type has operator==. As such, we optimize this operator
* for range-based for loop and just compare arrayZ. No need to compare length, as we * for range-based for loop and just compare arrayZ and length. */
* assume we're only compared to .end(). */
bool operator != (const hb_array_t& o) const bool operator != (const hb_array_t& o) const
{ return arrayZ != o.arrayZ; } { return this->arrayZ != o.arrayZ || this->length != o.length; }
/* Extra operators. /* Extra operators.
*/ */
@ -325,6 +324,8 @@ struct hb_sorted_array_t :
{ hb_array_t<Type> (*this) = o; return *this; } { hb_array_t<Type> (*this) = o; return *this; }
/* Iterator implementation. */ /* Iterator implementation. */
/* See comment in hb_array_of::operator != */
bool operator != (const hb_sorted_array_t& o) const bool operator != (const hb_sorted_array_t& o) const
{ return this->arrayZ != o.arrayZ || this->length != o.length; } { return this->arrayZ != o.arrayZ || this->length != o.length; }