diff --git a/src/hb-array.hh b/src/hb-array.hh index 62075c49f..03b52ec56 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -45,12 +45,11 @@ struct hb_array_t : * Constructors. */ hb_array_t () : arrayZ (nullptr), length (0) {} - hb_array_t (Type *array_, unsigned int length_) : arrayZ (array_), length (length_) {} template hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), length (o.length) {} + hb_array_t (Type *array_, unsigned int length_) : arrayZ (array_), length (length_) {} template hb_array_t (Type (&array_)[length_]) : arrayZ (array_), length (length_) {} - /* * Iterator implementation. */ @@ -185,7 +184,6 @@ template inline hb_array_t hb_array (T (&array_)[length_]) { return hb_array_t (array_); } - enum hb_bfind_not_found_t { HB_BFIND_NOT_FOUND_DONT_STORE, diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 18b156f53..1e1f0a68f 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -112,10 +112,21 @@ struct hb_iter_t /* Returns iterator type of a type. */ #define hb_iter_t(Iterable) decltype (hb_declval (Iterable).iter ()) + +/* TODO Change to function-object. */ + template inline hb_iter_t (T) hb_iter (const T& c) { return c.iter (); } +/* Specialization for C arrays. */ +template struct hb_array_t; +template inline hb_array_t +hb_iter (Type *array, unsigned int length) { return hb_array_t (array, length); } +template hb_array_t +hb_iter (Type (&array)[length]) { return hb_iter (array, length); } + + /* Mixin to fill in what the subclass doesn't provide. */ template struct hb_iter_mixin_t diff --git a/src/test-iter.cc b/src/test-iter.cc index b40ae1705..c36c5b975 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -118,6 +118,9 @@ main (int argc, char **argv) s2 = s; + hb_iter (src); + hb_iter (src, 2); + hb_fill (t, 42); hb_copy (t, s); // hb_copy (t, a.iter ()); @@ -139,7 +142,7 @@ main (int argc, char **argv) hb_array_t > pa; pa->as_array (); - + hb_iter (s) + + hb_iter (src) | hb_map (hb_identity) | hb_filter () | hb_filter (hb_bool)