diff --git a/src/hb-iter.hh b/src/hb-iter.hh index f23904c22..afb038272 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -202,15 +202,18 @@ struct hb_iter_with_fallback_t : /* hb_is_iterable() */ -template -struct _hb_is_iterable -{ enum { value = false }; }; -template -struct _hb_is_iterable > -{ enum { value = true }; }; +template +struct hb_is_iterable +{ + private: + template + static auto test (int) -> decltype (hb_declval (U).iter (), hb_true_t ()); + template + static hb_false_t test (...); -template -struct hb_is_iterable { enum { value = _hb_is_iterable::value }; }; + public: + enum { value = hb_is_same (decltype (test (0)), hb_true_t) }; +}; #define hb_is_iterable(Iterable) hb_is_iterable::value /* TODO Add hb_is_iterable_of().