From cdb61eb0431d426f7152f975e89ee3ba4431083f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 8 May 2019 11:00:18 -0700 Subject: [PATCH] [iter] Accept pointer in hb_iter() and hb_iter_t() --- src/hb-iter.hh | 4 ++-- src/test-iter.cc | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 5a76c9541..141165028 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -148,7 +148,7 @@ struct hb_iter_t static_assert (true, "") /* Returns iterator type of a type. */ -#define hb_iter_t(Iterable) decltype (hb_declval (Iterable).iter ()) +#define hb_iter_t(Iterable) decltype (hb_deref (hb_declval (Iterable)).iter ()) template struct hb_array_t; @@ -158,7 +158,7 @@ struct template hb_iter_t (T) operator () (T&& c) const - { return c.iter (); } + { return hb_deref (hb_forward (c)).iter (); } /* Specialization for C arrays. */ diff --git a/src/test-iter.cc b/src/test-iter.cc index 1e721aecb..ac2c30e09 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -179,6 +179,9 @@ main (int argc, char **argv) hb_map_t m; + hb_iter (st); + hb_iter (&st); + + hb_iter (src) | hb_map (m) | hb_map (&m)