From 7987095e64e52b509661828aeadabe0b27bba0d0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 9 Jan 2019 01:02:38 -0800 Subject: [PATCH] [meta] Remove hb_enable_if_t It was only used for C++<11 which does not allow default parameters in function templates. Looks like we cannot support <11 anyway, so, start cleaning up. --- src/hb-iter.hh | 18 +++++++++--------- src/hb-meta.hh | 1 - src/hb-open-type.hh | 14 ++++++-------- src/hb-ot-layout-common.hh | 21 +++++++++------------ src/test-iter.cc | 12 ++++++------ 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 06dd94a05..5f2511baf 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -197,18 +197,18 @@ struct hb_is_iterator_of { enum { * Algorithms operating on iterators or iteratables. */ -template inline - hb_enable_if_t (hb_is_iterable (C), -void) +template +inline void hb_fill (C& c, const V &v) { for (typename C::iter_t i (c); i; i++) hb_assign (*i, v); } -template inline - hb_enable_if_t (hb_is_iterator (S) && hb_is_iterator (D), -bool) +template +inline bool hb_copy (D id, S is) { for (; id && is; ++id, ++is) @@ -245,9 +245,9 @@ struct hb_zip_t : B b; }; -template inline -typename hb_enable_if >::type +template +inline hb_zip_t hb_zip (A& a, B &b) { return hb_zip_t (a.iter (), b.iter ()); } diff --git a/src/hb-meta.hh b/src/hb-meta.hh index c38ae7b64..a9f9df98b 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -69,7 +69,6 @@ template struct hb_enable_if { typedef T type; }; #define hb_enable_if(Cond) typename hb_enable_if<(Cond)>::type* = nullptr -#define hb_enable_if_t(Cond, Type) typename hb_enable_if<(Cond), Type>::type /* diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index e4ae43511..8c623b0f0 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -559,10 +559,9 @@ struct ArrayOf if (unlikely (!c->extend (*this))) return_trace (false); return_trace (true); } - template - hb_enable_if_t (hb_is_iterator_of (Iterator, const Type), - bool) serialize (hb_serialize_context_t *c, - Iterator items) + template + bool serialize (hb_serialize_context_t *c, Iterator items) { TRACE_SERIALIZE (this); unsigned count = items.len (); @@ -831,10 +830,9 @@ struct SortedArrayOf : ArrayOf bool ret = ArrayOf::serialize (c, items_len); return_trace (ret); } - template - hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const Type), - bool) serialize (hb_serialize_context_t *c, - Iterator items) + template + bool serialize (hb_serialize_context_t *c, Iterator items) { TRACE_SERIALIZE (this); bool ret = ArrayOf::serialize (c, items); diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index d7ae24e81..0a33449fb 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -825,10 +825,9 @@ struct CoverageFormat1 return i; } - template - hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), - bool) serialize (hb_serialize_context_t *c, - Iterator glyphs) + template + bool serialize (hb_serialize_context_t *c, Iterator glyphs) { TRACE_SERIALIZE (this); return_trace (glyphArray.serialize (c, glyphs)); @@ -894,10 +893,9 @@ struct CoverageFormat2 NOT_COVERED; } - template - hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), - bool) serialize (hb_serialize_context_t *c, - Iterator glyphs) + template + bool serialize (hb_serialize_context_t *c, Iterator glyphs) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); @@ -1051,10 +1049,9 @@ struct Coverage } } - template - hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), - bool) serialize (hb_serialize_context_t *c, - Iterator glyphs) + template + bool serialize (hb_serialize_context_t *c, Iterator glyphs) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); diff --git a/src/test-iter.cc b/src/test-iter.cc index e6beb0771..e3b258f9d 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -65,9 +65,9 @@ struct some_array_t }; -template static - hb_enable_if_t (hb_is_iterator (Iter), -void) +template +static void test_iterator (Iter it) { Iter default_constructed; @@ -85,9 +85,9 @@ test_iterator (Iter it) if (it.is_random_access_iterator) {} } -template static - hb_enable_if_t (hb_is_iterable (Iterable), -void) +template +static void test_iterable (const Iterable &lst = Null(Iterable)) { // Test that can take iterator from.