[meta] Remove hb_enable_if_t
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 9 Jan 2019 09:02:38 +0000 (01:02 -0800)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 21 Jan 2019 01:12:12 +0000 (20:12 -0500)
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
src/hb-meta.hh
src/hb-open-type.hh
src/hb-ot-layout-common.hh
src/test-iter.cc

index 06dd94a..5f2511b 100644 (file)
@@ -197,18 +197,18 @@ struct hb_is_iterator_of { enum {
  * Algorithms operating on iterators or iteratables.
  */
 
-template <typename C, typename V> inline
-  hb_enable_if_t (hb_is_iterable (C),
-void)
+template <typename C, typename V,
+         hb_enable_if (hb_is_iterable (C))>
+inline void
 hb_fill (C& c, const V &v)
 {
   for (typename C::iter_t i (c); i; i++)
     hb_assign (*i, v);
 }
 
-template <typename S, typename D> inline
-  hb_enable_if_t (hb_is_iterator (S) && hb_is_iterator (D),
-bool)
+template <typename S, typename D,
+         hb_enable_if (hb_is_iterator (S) && hb_is_iterator (D))>
+inline bool
 hb_copy (D id, S is)
 {
   for (; id && is; ++id, ++is)
@@ -245,9 +245,9 @@ struct hb_zip_t :
   B b;
 };
 
-template <typename A, typename B> inline
-typename hb_enable_if<hb_is_iterable (A) && hb_is_iterable (B),
-hb_zip_t<typename A::iter_t, typename B::iter_t> >::type
+template <typename A, typename B,
+         hb_enable_if (hb_is_iterable (A) && hb_is_iterable (B))>
+inline hb_zip_t<typename A::iter_t, typename B::iter_t>
 hb_zip (A& a, B &b)
 { return hb_zip_t<typename A::iter_t, typename B::iter_t> (a.iter (), b.iter ()); }
 
index c38ae7b..a9f9df9 100644 (file)
@@ -69,7 +69,6 @@ template<typename T>
 struct hb_enable_if<true, T> { 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
 
 
 /*
index e4ae435..8c623b0 100644 (file)
@@ -559,10 +559,9 @@ struct ArrayOf
     if (unlikely (!c->extend (*this))) return_trace (false);
     return_trace (true);
   }
-  template <typename Iterator>
-    hb_enable_if_t (hb_is_iterator_of (Iterator, const Type),
-  bool) serialize (hb_serialize_context_t *c,
-                  Iterator items)
+  template <typename Iterator,
+           hb_enable_if (hb_is_iterator_of (Iterator, const Type))>
+  bool serialize (hb_serialize_context_t *c, Iterator items)
   {
     TRACE_SERIALIZE (this);
     unsigned count = items.len ();
@@ -831,10 +830,9 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
     bool ret = ArrayOf<Type, LenType>::serialize (c, items_len);
     return_trace (ret);
   }
-  template <typename Iterator>
-    hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const Type),
-  bool) serialize (hb_serialize_context_t *c,
-                  Iterator items)
+  template <typename Iterator,
+           hb_enable_if (hb_is_sorted_iterator_of (Iterator, const Type))>
+  bool serialize (hb_serialize_context_t *c, Iterator items)
   {
     TRACE_SERIALIZE (this);
     bool ret = ArrayOf<Type, LenType>::serialize (c, items);
index d7ae24e..0a33449 100644 (file)
@@ -825,10 +825,9 @@ struct CoverageFormat1
     return i;
   }
 
-  template <typename Iterator>
-    hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID),
-  bool) serialize (hb_serialize_context_t *c,
-                  Iterator glyphs)
+  template <typename Iterator,
+           hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
+  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 <typename Iterator>
-    hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID),
-  bool) serialize (hb_serialize_context_t *c,
-                  Iterator glyphs)
+  template <typename Iterator,
+           hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
+  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 <typename Iterator>
-    hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID),
-  bool) serialize (hb_serialize_context_t *c,
-                  Iterator glyphs)
+  template <typename Iterator,
+           hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
+  bool serialize (hb_serialize_context_t *c, Iterator glyphs)
   {
     TRACE_SERIALIZE (this);
     if (unlikely (!c->extend_min (*this))) return_trace (false);
index e6beb07..e3b258f 100644 (file)
@@ -65,9 +65,9 @@ struct some_array_t
 };
 
 
-template <typename Iter> static
-  hb_enable_if_t (hb_is_iterator (Iter),
-void)
+template <typename Iter,
+         hb_enable_if (hb_is_iterator (Iter))>
+static void
 test_iterator (Iter it)
 {
   Iter default_constructed;
@@ -85,9 +85,9 @@ test_iterator (Iter it)
   if (it.is_random_access_iterator) {}
 }
 
-template <typename Iterable> static
-  hb_enable_if_t (hb_is_iterable (Iterable),
-void)
+template <typename Iterable,
+        hb_enable_if (hb_is_iterable (Iterable))>
+static void
 test_iterable (const Iterable &lst = Null(Iterable))
 {
   // Test that can take iterator from.