From 445364d80a06007de5ac4c0fca9bb0b846f25c9c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 8 Jan 2019 12:42:15 -0800 Subject: [PATCH] [iter] Rename hb_is_[sorted_]iterator() -> hb_is_[sorted_]iterator_of() --- src/hb-iter.hh | 15 +++++++++------ src/hb-open-type.hh | 4 ++-- src/hb-ot-layout-common.hh | 6 +++--- src/test-iter.cc | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index b4e25fb..a3987b3 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -162,7 +162,7 @@ struct hb_is_iterable { enum { value = _hb_is_iterable::value }; } /* hb_is_iterator() / hb_is_sorted_iterator() */ template -struct _hb_is_iterator +struct _hb_is_iterator_of { char operator () (...) { return 0; }; template int operator () (hb_iter_t *) { return 0; }; @@ -172,13 +172,16 @@ struct _hb_is_iterator static_assert (sizeof (char) != sizeof (int), ""); }; template -struct hb_is_iterator { enum { - value = sizeof (int) == sizeof (hb_declval (_hb_is_iterator) (hb_declval (Iter*))) }; }; -#define hb_is_iterator(Iter, Item) hb_is_iterator::value +struct hb_is_iterator_of { enum { + value = sizeof (int) == sizeof (hb_declval (_hb_is_iterator_of) (hb_declval (Iter*))) }; }; +#define hb_is_iterator_of(Iter, Item) hb_is_iterator_of::value +#define hb_is_iterator(Iter) hb_is_iterator_of (Iter, typename Iter::item_t) -#define hb_is_sorted_iterator(Iter, Item) \ - hb_is_iterator (Iter, Item) && \ +#define hb_is_sorted_iterator_of(Iter, Item) \ + hb_is_iterator_of (Iter, Item) && \ Iter::is_sorted_iterator +#define hb_is_sorted_iterator(Iter) \ + hb_is_sorted_iterator_of (Iter, typename Iter::item_t) /* * Algorithms operating on iterators or iteratables. diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 70c1654..4dc1e2c 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -554,7 +554,7 @@ struct ArrayOf return_trace (true); } template - hb_enable_if_t (hb_is_iterator (Iterator, const Type), + hb_enable_if_t (hb_is_iterator_of (Iterator, const Type), bool) serialize (hb_serialize_context_t *c, Iterator items) { @@ -822,7 +822,7 @@ struct SortedArrayOf : ArrayOf return_trace (ret); } template - hb_enable_if_t (hb_is_sorted_iterator (Iterator, const Type), + hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const Type), bool) serialize (hb_serialize_context_t *c, Iterator items) { diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 0479596..d82c262 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -827,7 +827,7 @@ struct CoverageFormat1 } template - hb_enable_if_t (hb_is_sorted_iterator (Iterator, const GlyphID), + hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), bool) serialize (hb_serialize_context_t *c, Iterator glyphs) { @@ -896,7 +896,7 @@ struct CoverageFormat2 } template - hb_enable_if_t (hb_is_sorted_iterator (Iterator, const GlyphID), + hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), bool) serialize (hb_serialize_context_t *c, Iterator glyphs) { @@ -1047,7 +1047,7 @@ struct Coverage } template - hb_enable_if_t (hb_is_sorted_iterator (Iterator, const GlyphID), + hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), bool) serialize (hb_serialize_context_t *c, Iterator glyphs) { diff --git a/src/test-iter.cc b/src/test-iter.cc index 071f7f9..d508e24 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -66,7 +66,7 @@ struct some_array_t template static - hb_enable_if_t (hb_is_iterator (Iter, typename Iter::item_t), + hb_enable_if_t (hb_is_iterator (Iter), void) test_iterator (Iter it) { -- 2.7.4