[iter] Accept pointer in hb_iter() and hb_iter_t()

This commit is contained in:
Behdad Esfahbod 2019-05-08 11:00:18 -07:00
parent c93eeba9b2
commit cdb61eb043
2 changed files with 5 additions and 2 deletions

View File

@ -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 <typename> struct hb_array_t;
@ -158,7 +158,7 @@ struct
template <typename T>
hb_iter_t (T)
operator () (T&& c) const
{ return c.iter (); }
{ return hb_deref (hb_forward<T> (c)).iter (); }
/* Specialization for C arrays. */

View File

@ -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)