[iter] Add hb_iter_with_fallback_t instead
This commit is contained in:
parent
4d40ed9d1a
commit
849a0f1758
|
@ -37,10 +37,7 @@ template <typename Type>
|
||||||
struct hb_sorted_array_t;
|
struct hb_sorted_array_t;
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
struct hb_array_t :
|
struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
||||||
hb_iter_with_mixin_t<hb_iter_fallback_mixin_t,
|
|
||||||
hb_array_t<Type>,
|
|
||||||
Type&>
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Constructors.
|
* Constructors.
|
||||||
|
|
|
@ -132,19 +132,6 @@ template <typename Type, unsigned int length> hb_array_t<Type>
|
||||||
hb_iter (Type (&array)[length]) { return hb_iter (array, length); }
|
hb_iter (Type (&array)[length]) { return hb_iter (array, length); }
|
||||||
|
|
||||||
|
|
||||||
template <template<typename iter_t, typename item_t> class mixin_t,
|
|
||||||
typename iter_t,
|
|
||||||
typename item_t = typename iter_t::__item_t__>
|
|
||||||
struct hb_iter_with_mixin_t :
|
|
||||||
hb_iter_t<iter_t, item_t>,
|
|
||||||
mixin_t<iter_t, item_t>
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
hb_iter_with_mixin_t () {}
|
|
||||||
hb_iter_with_mixin_t (const hb_iter_with_mixin_t &o HB_UNUSED) {}
|
|
||||||
void operator = (const hb_iter_with_mixin_t &o HB_UNUSED) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Mixin to fill in what the subclass doesn't provide. */
|
/* Mixin to fill in what the subclass doesn't provide. */
|
||||||
template <typename iter_t, typename item_t = typename iter_t::__item_t__>
|
template <typename iter_t, typename item_t = typename iter_t::__item_t__>
|
||||||
struct hb_iter_fallback_mixin_t
|
struct hb_iter_fallback_mixin_t
|
||||||
|
@ -178,6 +165,17 @@ struct hb_iter_fallback_mixin_t
|
||||||
void operator = (const hb_iter_fallback_mixin_t &o HB_UNUSED) {}
|
void operator = (const hb_iter_fallback_mixin_t &o HB_UNUSED) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename iter_t, typename item_t = typename iter_t::__item_t__>
|
||||||
|
struct hb_iter_with_fallback_t :
|
||||||
|
hb_iter_t<iter_t, item_t>,
|
||||||
|
hb_iter_fallback_mixin_t<iter_t, item_t>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
hb_iter_with_fallback_t () {}
|
||||||
|
hb_iter_with_fallback_t (const hb_iter_with_fallback_t &o HB_UNUSED) {}
|
||||||
|
void operator = (const hb_iter_with_fallback_t &o HB_UNUSED) {}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Meta-programming predicates.
|
* Meta-programming predicates.
|
||||||
*/
|
*/
|
||||||
|
@ -283,9 +281,8 @@ hb_map (Proj&& f)
|
||||||
template <typename Iter, typename Pred, typename Proj,
|
template <typename Iter, typename Pred, typename Proj,
|
||||||
hb_enable_if (hb_is_iterator (Iter))>
|
hb_enable_if (hb_is_iterator (Iter))>
|
||||||
struct hb_filter_iter_t :
|
struct hb_filter_iter_t :
|
||||||
hb_iter_with_mixin_t<hb_iter_fallback_mixin_t,
|
hb_iter_with_fallback_t<hb_filter_iter_t<Iter, Pred, Proj>,
|
||||||
hb_filter_iter_t<Iter, Pred, Proj>,
|
typename Iter::item_t>
|
||||||
typename Iter::item_t>
|
|
||||||
{
|
{
|
||||||
hb_filter_iter_t (const Iter& it_, Pred&& p, Proj&& f) : it (it_), p (p), f (f)
|
hb_filter_iter_t (const Iter& it_, Pred&& p, Proj&& f) : it (it_), p (p), f (f)
|
||||||
{ while (it && !p (f (*it))) ++it; }
|
{ while (it && !p (f (*it))) ++it; }
|
||||||
|
|
|
@ -1120,10 +1120,7 @@ struct Coverage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct iter_t :
|
struct iter_t : hb_iter_with_fallback_t<iter_t, hb_codepoint_t>
|
||||||
hb_iter_with_mixin_t<hb_iter_fallback_mixin_t,
|
|
||||||
iter_t,
|
|
||||||
hb_codepoint_t>
|
|
||||||
{
|
{
|
||||||
static constexpr bool is_sorted_iterator = true;
|
static constexpr bool is_sorted_iterator = true;
|
||||||
iter_t (const Coverage &c_ = Null(Coverage))
|
iter_t (const Coverage &c_ = Null(Coverage))
|
||||||
|
|
|
@ -682,10 +682,7 @@ struct hb_set_t
|
||||||
/*
|
/*
|
||||||
* Iterator implementation.
|
* Iterator implementation.
|
||||||
*/
|
*/
|
||||||
struct iter_t :
|
struct iter_t : hb_iter_with_fallback_t<iter_t, hb_codepoint_t>
|
||||||
hb_iter_with_mixin_t<hb_iter_fallback_mixin_t,
|
|
||||||
iter_t,
|
|
||||||
hb_codepoint_t>
|
|
||||||
{
|
{
|
||||||
static constexpr bool is_sorted_iterator = true;
|
static constexpr bool is_sorted_iterator = true;
|
||||||
iter_t (const hb_set_t &s_ = Null(hb_set_t)) :
|
iter_t (const hb_set_t &s_ = Null(hb_set_t)) :
|
||||||
|
|
|
@ -33,10 +33,7 @@
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct array_iter_t :
|
struct array_iter_t : hb_iter_with_fallback_t<array_iter_t<T>, T&>
|
||||||
hb_iter_with_mixin_t<hb_iter_fallback_mixin_t,
|
|
||||||
array_iter_t<T>,
|
|
||||||
T&>
|
|
||||||
{
|
{
|
||||||
array_iter_t (hb_array_t<T> arr_) : arr (arr_) {}
|
array_iter_t (hb_array_t<T> arr_) : arr (arr_) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue