[meta] Replace most hb_enable_if with hb_requires
They do absolutely same thing. hb_requires is to encode constraints, whereas hb_enable_if is for more conditional enabling.
This commit is contained in:
parent
6fa1f38070
commit
af571dbffc
|
@ -281,11 +281,11 @@ struct hb_is_iterator_of { enum {
|
|||
/* Range-based 'for' for iterables. */
|
||||
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
static inline auto begin (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).begin ())
|
||||
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
static inline auto end (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).end ())
|
||||
|
||||
/* begin()/end() are NOT looked up non-ADL. So each namespace must declare them.
|
||||
|
@ -293,11 +293,11 @@ static inline auto end (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).
|
|||
namespace OT {
|
||||
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
static inline auto begin (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).begin ())
|
||||
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
static inline auto end (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).end ())
|
||||
|
||||
}
|
||||
|
@ -308,14 +308,14 @@ static inline auto end (Iterable&& iterable) HB_AUTO_RETURN (hb_iter (iterable).
|
|||
*/
|
||||
|
||||
template <typename Lhs, typename Rhs,
|
||||
hb_enable_if (hb_is_iterator (Lhs))>
|
||||
hb_requires (hb_is_iterator (Lhs))>
|
||||
static inline auto
|
||||
operator | (Lhs lhs, const Rhs &rhs) HB_AUTO_RETURN (rhs (lhs))
|
||||
|
||||
/* hb_map(), hb_filter(), hb_reduce() */
|
||||
|
||||
template <typename Iter, typename Proj,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
struct hb_map_iter_t :
|
||||
hb_iter_t<hb_map_iter_t<Iter, Proj>,
|
||||
decltype (hb_declval (Proj) (hb_declval (typename Iter::item_t)))>
|
||||
|
@ -347,7 +347,7 @@ struct hb_map_iter_factory_t
|
|||
hb_map_iter_factory_t (Proj f) : f (f) {}
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
hb_map_iter_t<Iter, Proj>
|
||||
operator () (Iter it) const
|
||||
{ return hb_map_iter_t<Iter, Proj> (it, f); }
|
||||
|
@ -365,7 +365,7 @@ struct
|
|||
HB_FUNCOBJ (hb_map);
|
||||
|
||||
template <typename Iter, typename Pred, typename Proj,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
struct hb_filter_iter_t :
|
||||
hb_iter_with_fallback_t<hb_filter_iter_t<Iter, Pred, Proj>,
|
||||
typename Iter::item_t>
|
||||
|
@ -394,7 +394,7 @@ struct hb_filter_iter_factory_t
|
|||
hb_filter_iter_factory_t (Pred p, Proj f) : p (p), f (f) {}
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
hb_filter_iter_t<Iter, Pred, Proj>
|
||||
operator () (Iter it) const
|
||||
{ return hb_filter_iter_t<Iter, Pred, Proj> (it, p, f); }
|
||||
|
@ -419,7 +419,7 @@ struct hb_reduce_t
|
|||
hb_reduce_t (Redu r, InitT init_value) : r (r), init_value (init_value) {}
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter)),
|
||||
hb_requires (hb_is_iterator (Iter)),
|
||||
typename AccuT = decltype (hb_declval (Redu) (hb_declval (InitT), hb_declval (typename Iter::item_t)))>
|
||||
AccuT
|
||||
operator () (Iter it) const
|
||||
|
@ -480,7 +480,7 @@ struct hb_zip_iter_t :
|
|||
struct
|
||||
{
|
||||
template <typename A, typename B,
|
||||
hb_enable_if (hb_is_iterable (A) && hb_is_iterable (B))>
|
||||
hb_requires (hb_is_iterable (A) && hb_is_iterable (B))>
|
||||
hb_zip_iter_t<hb_iter_t (A), hb_iter_t (B)>
|
||||
operator () (A& a, B &b) const
|
||||
{ return hb_zip_iter_t<hb_iter_t (A), hb_iter_t (B)> (hb_iter (a), hb_iter (b)); }
|
||||
|
@ -490,7 +490,7 @@ HB_FUNCOBJ (hb_zip);
|
|||
/* hb_enumerate */
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
struct hb_enumerate_iter_t :
|
||||
hb_iter_t<hb_enumerate_iter_t<Iter>,
|
||||
hb_pair_t<unsigned, typename Iter::item_t>>
|
||||
|
@ -527,7 +527,7 @@ struct hb_enumerate_iter_t :
|
|||
struct
|
||||
{
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
hb_enumerate_iter_t<hb_iter_t (Iterable)>
|
||||
operator () (Iterable& it) const
|
||||
{ return hb_enumerate_iter_t<hb_iter_t (Iterable)> (hb_iter (it)); }
|
||||
|
@ -542,9 +542,8 @@ struct hb_apply_t
|
|||
hb_apply_t (Appl a) : a (a) {}
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
void
|
||||
operator () (Iter it) const
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
void operator () (Iter it) const
|
||||
{
|
||||
for (; it; ++it)
|
||||
(void) hb_invoke (a, *it);
|
||||
|
@ -573,9 +572,8 @@ struct hb_sink_t
|
|||
hb_sink_t (Sink&& s) : s (s) {}
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
void
|
||||
operator () (Iter it) const
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
void operator () (Iter it) const
|
||||
{
|
||||
for (; it; ++it)
|
||||
s << *it;
|
||||
|
@ -601,9 +599,8 @@ HB_FUNCOBJ (hb_sink);
|
|||
struct
|
||||
{
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
void
|
||||
operator () (Iter it) const
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
void operator () (Iter it) const
|
||||
{
|
||||
for (; it; ++it)
|
||||
(void) *it;
|
||||
|
@ -619,9 +616,8 @@ struct hb_unzip_t
|
|||
hb_unzip_t (Sink1&& s1, Sink2&& s2) : s1 (s1), s2 (s2) {}
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
void
|
||||
operator () (Iter it) const
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
void operator () (Iter it) const
|
||||
{
|
||||
for (; it; ++it)
|
||||
{
|
||||
|
@ -653,9 +649,8 @@ HB_FUNCOBJ (hb_unzip);
|
|||
struct
|
||||
{
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
bool
|
||||
operator () (Iterable&& c) const
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
bool operator () (Iterable&& c) const
|
||||
{
|
||||
for (auto it = hb_iter (c); it; ++it)
|
||||
if (!*it)
|
||||
|
@ -667,9 +662,8 @@ HB_FUNCOBJ (hb_all);
|
|||
struct
|
||||
{
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
bool
|
||||
operator () (Iterable&& c) const
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
bool operator () (Iterable&& c) const
|
||||
{
|
||||
for (auto it = hb_iter (c); it; ++it)
|
||||
if (*it)
|
||||
|
@ -681,9 +675,8 @@ HB_FUNCOBJ (hb_any);
|
|||
struct
|
||||
{
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
bool
|
||||
operator () (Iterable&& c) const
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
bool operator () (Iterable&& c) const
|
||||
{
|
||||
for (auto it = hb_iter (c); it; ++it)
|
||||
if (*it)
|
||||
|
@ -698,7 +691,7 @@ HB_FUNCOBJ (hb_none);
|
|||
*/
|
||||
|
||||
template <typename C, typename V,
|
||||
hb_enable_if (hb_is_iterable (C))>
|
||||
hb_requires (hb_is_iterable (C))>
|
||||
inline void
|
||||
hb_fill (C& c, const V &v)
|
||||
{
|
||||
|
|
|
@ -419,7 +419,7 @@ struct UnsizedArrayOf
|
|||
return_trace (true);
|
||||
}
|
||||
template <typename Iterator,
|
||||
hb_enable_if (hb_is_iterator_of (Iterator, const Type))>
|
||||
hb_requires (hb_is_iterator_of (Iterator, const Type))>
|
||||
bool serialize (hb_serialize_context_t *c, Iterator items)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
|
@ -600,7 +600,7 @@ struct ArrayOf
|
|||
return_trace (true);
|
||||
}
|
||||
template <typename Iterator,
|
||||
hb_enable_if (hb_is_iterator_of (Iterator, const Type))>
|
||||
hb_requires (hb_is_iterator_of (Iterator, const Type))>
|
||||
bool serialize (hb_serialize_context_t *c, Iterator items)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
|
@ -880,7 +880,7 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
|
|||
return_trace (ret);
|
||||
}
|
||||
template <typename Iterator,
|
||||
hb_enable_if (hb_is_sorted_iterator_of (Iterator, const Type))>
|
||||
hb_requires (hb_is_sorted_iterator_of (Iterator, const Type))>
|
||||
bool serialize (hb_serialize_context_t *c, Iterator items)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
|
|
|
@ -797,7 +797,7 @@ struct CoverageFormat1
|
|||
}
|
||||
|
||||
template <typename Iterator,
|
||||
hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
|
||||
hb_requires (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
|
||||
bool serialize (hb_serialize_context_t *c, Iterator glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
|
@ -866,7 +866,7 @@ struct CoverageFormat2
|
|||
}
|
||||
|
||||
template <typename Iterator,
|
||||
hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
|
||||
hb_requires (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
|
||||
bool serialize (hb_serialize_context_t *c, Iterator glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
|
@ -1030,7 +1030,7 @@ struct Coverage
|
|||
}
|
||||
|
||||
template <typename Iterator,
|
||||
hb_enable_if (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
|
||||
hb_requires (hb_is_sorted_iterator_of (Iterator, const GlyphID))>
|
||||
bool serialize (hb_serialize_context_t *c, Iterator glyphs)
|
||||
{
|
||||
TRACE_SERIALIZE (this);
|
||||
|
|
|
@ -65,7 +65,7 @@ struct some_array_t
|
|||
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
static void
|
||||
test_iterator_non_default_constructable (Iter it)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ test_iterator_non_default_constructable (Iter it)
|
|||
}
|
||||
|
||||
template <typename Iter,
|
||||
hb_enable_if (hb_is_iterator (Iter))>
|
||||
hb_requires (hb_is_iterator (Iter))>
|
||||
static void
|
||||
test_iterator (Iter it)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ test_iterator (Iter it)
|
|||
}
|
||||
|
||||
template <typename Iterable,
|
||||
hb_enable_if (hb_is_iterable (Iterable))>
|
||||
hb_requires (hb_is_iterable (Iterable))>
|
||||
static void
|
||||
test_iterable (const Iterable &lst = Null(Iterable))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue