[iter] Make hb_sorted_array_t work as iter
Ugly, but does the job.
This commit is contained in:
parent
d6024794fb
commit
570473a345
|
@ -194,9 +194,11 @@ enum hb_bfind_not_found_t
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
struct hb_sorted_array_t :
|
struct hb_sorted_array_t :
|
||||||
hb_sorted_iter_t<hb_sorted_array_t<Type>, Type>,
|
hb_sorted_iter_t<hb_sorted_array_t<Type>, Type>,
|
||||||
hb_array_t<Type>,
|
hb_array_t<Type>
|
||||||
hb_iter_mixin_t<hb_sorted_array_t<Type>, Type>
|
|
||||||
{
|
{
|
||||||
|
typedef hb_sorted_iter_t<hb_sorted_array_t<Type>, Type> iter_base_t;
|
||||||
|
HB_ITER_USING (iter_base_t);
|
||||||
|
|
||||||
hb_sorted_array_t () : hb_array_t<Type> () {}
|
hb_sorted_array_t () : hb_array_t<Type> () {}
|
||||||
hb_sorted_array_t (const hb_array_t<Type> &o) : hb_array_t<Type> (o) {}
|
hb_sorted_array_t (const hb_array_t<Type> &o) : hb_array_t<Type> (o) {}
|
||||||
hb_sorted_array_t (Type *array_, unsigned int length_) : hb_array_t<Type> (array_, length_) {}
|
hb_sorted_array_t (Type *array_, unsigned int length_) : hb_array_t<Type> (array_, length_) {}
|
||||||
|
|
|
@ -80,6 +80,24 @@ struct hb_iter_t
|
||||||
void operator = (const hb_iter_t &o HB_UNUSED) {}
|
void operator = (const hb_iter_t &o HB_UNUSED) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define HB_ITER_USING(Name) \
|
||||||
|
using Name::iter; \
|
||||||
|
using Name::operator bool; \
|
||||||
|
using Name::len; \
|
||||||
|
using Name::operator ->; \
|
||||||
|
using Name::operator *; \
|
||||||
|
using Name::operator []; \
|
||||||
|
using Name::operator +=; \
|
||||||
|
using Name::operator ++; \
|
||||||
|
using Name::operator -=; \
|
||||||
|
using Name::operator --; \
|
||||||
|
using Name::operator +; \
|
||||||
|
using Name::operator -; \
|
||||||
|
using Name::is_random_access; \
|
||||||
|
static_assert (true, "")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Base class for sorted iterators. Does not enforce anything.
|
/* Base class for sorted iterators. Does not enforce anything.
|
||||||
* Just for class taxonomy and requirements. */
|
* Just for class taxonomy and requirements. */
|
||||||
template <typename Iter, typename Item = typename Iter::__item_type__>
|
template <typename Iter, typename Item = typename Iter::__item_type__>
|
||||||
|
|
|
@ -109,6 +109,8 @@ main (int argc, char **argv)
|
||||||
test_iterable (v);
|
test_iterable (v);
|
||||||
hb_set_t st;
|
hb_set_t st;
|
||||||
test_iterable (st);
|
test_iterable (st);
|
||||||
|
hb_sorted_array_t<int> sa;
|
||||||
|
test_iterable (sa);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue