From 778c96b8d7b86ae2a0fe944f499fa4a57c12e365 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 27 Jan 2019 00:50:54 +0100 Subject: [PATCH] [iter] Fix hb_iter() --- src/hb-algs.hh | 4 ---- src/hb-iter.hh | 10 +++++++--- src/test-iter.cc | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index bd03a74ea..cf1c554da 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -31,10 +31,6 @@ #include "hb-null.hh" -template -inline typename T::iter_t -hb_iter (const T& c) { return c.iter (); } - static HB_UNUSED const struct hb_identity_ft { template T diff --git a/src/hb-iter.hh b/src/hb-iter.hh index b98231070..18b156f53 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -91,9 +91,6 @@ struct hb_iter_t void operator = (const hb_iter_t &o HB_UNUSED) {} }; -/* Returns iterator type of a type. */ -#define hb_iter_t(Iterable) decltype (hb_declval (Iterable).iter ()) - #define HB_ITER_USING(Name) \ using item_t = typename Name::item_t; \ using Name::item_size; \ @@ -112,6 +109,13 @@ struct hb_iter_t using Name::operator -; \ static_assert (true, "") +/* Returns iterator type of a type. */ +#define hb_iter_t(Iterable) decltype (hb_declval (Iterable).iter ()) + +template +inline hb_iter_t (T) +hb_iter (const T& c) { return c.iter (); } + /* 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 ef3543498..95bfa29d1 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -135,7 +135,7 @@ main (int argc, char **argv) hb_array_t > pa; pa->as_array (); - + s + + hb_iter (s) | hb_map (hb_identity) | hb_filter () | hb_filter (hb_bool)