提交 7987095e 编写于 作者: B Behdad Esfahbod

[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.
上级 15a69284
...@@ -197,18 +197,18 @@ struct hb_is_iterator_of { enum { ...@@ -197,18 +197,18 @@ struct hb_is_iterator_of { enum {
* Algorithms operating on iterators or iteratables. * Algorithms operating on iterators or iteratables.
*/ */
template <typename C, typename V> inline template <typename C, typename V,
hb_enable_if_t (hb_is_iterable (C), hb_enable_if (hb_is_iterable (C))>
void) inline void
hb_fill (C& c, const V &v) hb_fill (C& c, const V &v)
{ {
for (typename C::iter_t i (c); i; i++) for (typename C::iter_t i (c); i; i++)
hb_assign (*i, v); hb_assign (*i, v);
} }
template <typename S, typename D> inline template <typename S, typename D,
hb_enable_if_t (hb_is_iterator (S) && hb_is_iterator (D), hb_enable_if (hb_is_iterator (S) && hb_is_iterator (D))>
bool) inline bool
hb_copy (D id, S is) hb_copy (D id, S is)
{ {
for (; id && is; ++id, ++is) for (; id && is; ++id, ++is)
...@@ -245,9 +245,9 @@ struct hb_zip_t : ...@@ -245,9 +245,9 @@ struct hb_zip_t :
B b; B b;
}; };
template <typename A, typename B> inline template <typename A, typename B,
typename hb_enable_if<hb_is_iterable (A) && hb_is_iterable (B), hb_enable_if (hb_is_iterable (A) && hb_is_iterable (B))>
hb_zip_t<typename A::iter_t, typename B::iter_t> >::type inline hb_zip_t<typename A::iter_t, typename B::iter_t>
hb_zip (A& a, B &b) hb_zip (A& a, B &b)
{ return hb_zip_t<typename A::iter_t, typename B::iter_t> (a.iter (), b.iter ()); } { return hb_zip_t<typename A::iter_t, typename B::iter_t> (a.iter (), b.iter ()); }
......
...@@ -69,7 +69,6 @@ template<typename T> ...@@ -69,7 +69,6 @@ template<typename T>
struct hb_enable_if<true, T> { typedef T type; }; 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(Cond) typename hb_enable_if<(Cond)>::type* = nullptr
#define hb_enable_if_t(Cond, Type) typename hb_enable_if<(Cond), Type>::type
/* /*
......
...@@ -559,10 +559,9 @@ struct ArrayOf ...@@ -559,10 +559,9 @@ struct ArrayOf
if (unlikely (!c->extend (*this))) return_trace (false); if (unlikely (!c->extend (*this))) return_trace (false);
return_trace (true); return_trace (true);
} }
template <typename Iterator> template <typename Iterator,
hb_enable_if_t (hb_is_iterator_of (Iterator, const Type), hb_enable_if (hb_is_iterator_of (Iterator, const Type))>
bool) serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c, Iterator items)
Iterator items)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
unsigned count = items.len (); unsigned count = items.len ();
...@@ -831,10 +830,9 @@ struct SortedArrayOf : ArrayOf<Type, LenType> ...@@ -831,10 +830,9 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
bool ret = ArrayOf<Type, LenType>::serialize (c, items_len); bool ret = ArrayOf<Type, LenType>::serialize (c, items_len);
return_trace (ret); return_trace (ret);
} }
template <typename Iterator> template <typename Iterator,
hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const Type), hb_enable_if (hb_is_sorted_iterator_of (Iterator, const Type))>
bool) serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c, Iterator items)
Iterator items)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
bool ret = ArrayOf<Type, LenType>::serialize (c, items); bool ret = ArrayOf<Type, LenType>::serialize (c, items);
......
...@@ -825,10 +825,9 @@ struct CoverageFormat1 ...@@ -825,10 +825,9 @@ struct CoverageFormat1
return i; return i;
} }
template <typename Iterator> template <typename Iterator,
hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
bool) serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c, Iterator glyphs)
Iterator glyphs)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
return_trace (glyphArray.serialize (c, glyphs)); return_trace (glyphArray.serialize (c, glyphs));
...@@ -894,10 +893,9 @@ struct CoverageFormat2 ...@@ -894,10 +893,9 @@ struct CoverageFormat2
NOT_COVERED; NOT_COVERED;
} }
template <typename Iterator> template <typename Iterator,
hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
bool) serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c, Iterator glyphs)
Iterator glyphs)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
...@@ -1051,10 +1049,9 @@ struct Coverage ...@@ -1051,10 +1049,9 @@ struct Coverage
} }
} }
template <typename Iterator> template <typename Iterator,
hb_enable_if_t (hb_is_sorted_iterator_of (Iterator, const GlyphID), hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
bool) serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c, Iterator glyphs)
Iterator glyphs)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
......
...@@ -65,9 +65,9 @@ struct some_array_t ...@@ -65,9 +65,9 @@ struct some_array_t
}; };
template <typename Iter> static template <typename Iter,
hb_enable_if_t (hb_is_iterator (Iter), hb_enable_if (hb_is_iterator (Iter))>
void) static void
test_iterator (Iter it) test_iterator (Iter it)
{ {
Iter default_constructed; Iter default_constructed;
...@@ -85,9 +85,9 @@ test_iterator (Iter it) ...@@ -85,9 +85,9 @@ test_iterator (Iter it)
if (it.is_random_access_iterator) {} if (it.is_random_access_iterator) {}
} }
template <typename Iterable> static template <typename Iterable,
hb_enable_if_t (hb_is_iterable (Iterable), hb_enable_if (hb_is_iterable (Iterable))>
void) static void
test_iterable (const Iterable &lst = Null(Iterable)) test_iterable (const Iterable &lst = Null(Iterable))
{ {
// Test that can take iterator from. // Test that can take iterator from.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册