[array] Minor

This commit is contained in:
Behdad Esfahbod 2018-12-16 20:20:35 -05:00
parent 5a552f7546
commit aa8f94714e
2 changed files with 5 additions and 1 deletions

View File

@ -41,6 +41,8 @@ struct hb_bytes_t
operator const void * (void) const { return arrayZ; } operator const void * (void) const { return arrayZ; }
operator const char * (void) const { return arrayZ; } operator const char * (void) const { return arrayZ; }
explicit_operator bool (void) const { return len; }
void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; } void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
int cmp (const hb_bytes_t &a) const int cmp (const hb_bytes_t &a) const
@ -80,6 +82,8 @@ struct hb_array_t
return arrayZ[i]; return arrayZ[i];
} }
explicit_operator bool (void) const { return len; }
template <typename T> operator T * (void) const { return arrayZ; } template <typename T> operator T * (void) const { return arrayZ; }
Type * operator & (void) const { return arrayZ; } Type * operator & (void) const { return arrayZ; }

View File

@ -72,7 +72,7 @@ struct Iter<T *>
array (array_), length (length_) {} array (array_), length (length_) {}
/* Emptiness. */ /* Emptiness. */
explicit_operator bool (void) const { return bool (length); } explicit_operator bool (void) const { return length; }
/* Current item. */ /* Current item. */
T &operator * (void) T &operator * (void)