[iter] Fix hb_iter()

This commit is contained in:
Behdad Esfahbod 2019-01-27 00:50:54 +01:00
parent 2f5b1a9104
commit 778c96b8d7
3 changed files with 8 additions and 8 deletions

View File

@ -31,10 +31,6 @@
#include "hb-null.hh" #include "hb-null.hh"
template <typename T>
inline typename T::iter_t
hb_iter (const T& c) { return c.iter (); }
static HB_UNUSED const struct hb_identity_ft static HB_UNUSED const struct hb_identity_ft
{ {
template <typename T> T template <typename T> T

View File

@ -91,9 +91,6 @@ struct hb_iter_t
void operator = (const hb_iter_t &o HB_UNUSED) {} 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) \ #define HB_ITER_USING(Name) \
using item_t = typename Name::item_t; \ using item_t = typename Name::item_t; \
using Name::item_size; \ using Name::item_size; \
@ -112,6 +109,13 @@ struct hb_iter_t
using Name::operator -; \ using Name::operator -; \
static_assert (true, "") static_assert (true, "")
/* Returns iterator type of a type. */
#define hb_iter_t(Iterable) decltype (hb_declval (Iterable).iter ())
template <typename T>
inline hb_iter_t (T)
hb_iter (const T& c) { return c.iter (); }
/* Mixin to fill in what the subclass doesn't provide. */ /* Mixin to fill in what the subclass doesn't provide. */
template <typename iter_t, typename item_t = typename iter_t::__item_t__> template <typename iter_t, typename item_t = typename iter_t::__item_t__>
struct hb_iter_mixin_t struct hb_iter_mixin_t

View File

@ -135,7 +135,7 @@ main (int argc, char **argv)
hb_array_t<hb_vector_t<int> > pa; hb_array_t<hb_vector_t<int> > pa;
pa->as_array (); pa->as_array ();
+ s + hb_iter (s)
| hb_map (hb_identity) | hb_map (hb_identity)
| hb_filter () | hb_filter ()
| hb_filter (hb_bool) | hb_filter (hb_bool)