From c93eeba9b21cb8f8ba64ebaf284bf9c8a8544886 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 8 May 2019 10:56:09 -0700 Subject: [PATCH] [iter] Accept pointer in hb_map() --- src/hb-iter.hh | 4 ++-- src/test-iter.cc | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 1a3e2ab..5a76c95 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -324,11 +324,11 @@ template struct hb_map_iter_t : hb_iter_t, - decltype (hb_declval (Proj) (hb_declval (typename Iter::item_t)))> + decltype (hb_get (hb_declval (Proj), *hb_declval (Iter)))> { hb_map_iter_t (const Iter& it, Proj f_) : it (it), f (f_) {} - typedef decltype (hb_declval (Proj) (hb_declval (typename Iter::item_t))) __item_t__; + typedef decltype (hb_get (hb_declval (Proj), *hb_declval (Iter))) __item_t__; static constexpr bool is_random_access_iterator = Iter::is_random_access_iterator; __item_t__ __item__ () const { return hb_get (f.get (), *it); } __item_t__ __item_at__ (unsigned i) const { return hb_get (f.get (), it[i]); } diff --git a/src/test-iter.cc b/src/test-iter.cc index f29166f..1e721ae 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -177,9 +177,14 @@ main (int argc, char **argv) hb_array_t> pa; pa->as_array (); + hb_map_t m; + + hb_iter (src) - | hb_map (hb_identity) + | hb_map (m) + | hb_map (&m) | hb_filter () + | hb_filter (st) + | hb_filter (&st) | hb_filter (hb_bool) | hb_filter (hb_bool, hb_identity) | hb_sink (st) -- 2.7.4