From ed4336680d3fc080f99c7dd67db48c55bcd7a020 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 7 Jan 2019 17:24:23 -0500 Subject: [PATCH] [iter] Handhold hb_is_iterator() type deduction by partial-instantiating on Iter. --- src/hb-iter.hh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 7b975e6b..5c02a27f 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -161,15 +161,19 @@ struct hb_is_iterable { enum { value = _hb_is_iterable::value }; } /* hb_is_iterator() / hb_is_sorted_iterator() */ -template char _hb_is_iterator (...) { return 0; }; -template int _hb_is_iterator (hb_iter_t *) { return 0; }; -template int _hb_is_iterator (hb_iter_t *) { return 0; }; -template int _hb_is_iterator (hb_iter_t *) { return 0; }; -template int _hb_is_iterator (hb_iter_t *) { return 0; }; -static_assert (sizeof (char) != sizeof (int), ""); +template +struct _hb_is_iterator +{ + char operator () (...) { return 0; }; + template int operator () (hb_iter_t *) { return 0; }; + template int operator () (hb_iter_t *) { return 0; }; + template int operator () (hb_iter_t *) { return 0; }; + template int operator () (hb_iter_t *) { return 0; }; + static_assert (sizeof (char) != sizeof (int), ""); +}; template struct hb_is_iterator { enum { - value = sizeof (int) == sizeof (_hb_is_iterator (hb_declval ())) }; }; + value = sizeof (int) == sizeof (hb_declval<_hb_is_iterator> () (hb_declval ())) }; }; #define hb_is_iterator(Iter, Item) hb_is_iterator::value #define hb_is_sorted_iterator(Iter, Item) \ -- GitLab