[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.
This commit is contained in:
Behdad Esfahbod 2019-01-09 01:02:38 -08:00
parent 15a6928436
commit 7987095e64
5 changed files with 30 additions and 36 deletions

View 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 ()); }

View 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
/*

View 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);

View 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);

View 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.