[iter] Add hb_len()
diff --git a/src/hb-iter.hh b/src/hb-iter.hh
index b8d2dd5..42ae074 100644
--- a/src/hb-iter.hh
+++ b/src/hb-iter.hh
@@ -175,6 +175,14 @@
}
HB_FUNCOBJ (hb_iter);
+struct
+{
+ template <typename T> unsigned
+ operator () (T&& c) const
+ { return c.len (); }
+
+}
+HB_FUNCOBJ (hb_len);
/* Mixin to fill in what the subclass doesn't provide. */
template <typename iter_t, typename item_t = typename iter_t::__item_t__>
diff --git a/src/test-iter.cc b/src/test-iter.cc
index 7ce6d8f..10db975 100644
--- a/src/test-iter.cc
+++ b/src/test-iter.cc
@@ -272,7 +272,7 @@
hb_repeat (7u);
hb_repeat (nullptr);
hb_repeat (vl);
- assert ((hb_range (10) | hb_take (3)).len () == 3);
+ assert (hb_len (hb_range (10) | hb_take (3)) == 3);
assert (hb_range (9).len () == 9);
assert (hb_range (2, 9).len () == 7);
assert (hb_range (2, 9, 3).len () == 3);