[array] Minor
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 17 Dec 2018 01:20:35 +0000 (20:20 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 17 Dec 2018 03:31:13 +0000 (22:31 -0500)
src/hb-array.hh
src/hb-iter.hh

index 9b9f858..fd3bd44 100644 (file)
@@ -41,6 +41,8 @@ struct hb_bytes_t
   operator const void * (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; }
 
   int cmp (const hb_bytes_t &a) const
@@ -80,6 +82,8 @@ struct hb_array_t
     return arrayZ[i];
   }
 
+  explicit_operator bool (void) const { return len; }
+
   template <typename T> operator  T * (void) const { return arrayZ; }
 
   Type * operator & (void) const { return arrayZ; }
index b697ef9..5b6cbc4 100644 (file)
@@ -72,7 +72,7 @@ struct Iter<T *>
     array (array_), length (length_) {}
 
   /* Emptiness. */
-  explicit_operator bool (void) const { return bool (length); }
+  explicit_operator bool (void) const { return length; }
 
   /* Current item. */
   T &operator * (void)