diff --git a/src/hb-iter.hh b/src/hb-iter.hh index c14fee907..b9d9f286a 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -602,13 +602,13 @@ struct } HB_FUNCOBJ (hb_apply); -/* hb_iota()/hb_range() */ +/* hb_range()/hb_iota() */ template -struct hb_counter_iter_t : - hb_iter_t, T> +struct hb_range_iter_t : + hb_iter_t, T> { - hb_counter_iter_t (T start, T end_, S step) : v (start), end_ (end_for (start, end_, step)), step (step) {} + hb_range_iter_t (T start, T end_, S step) : v (start), end_ (end_for (start, end_, step)), step (step) {} typedef T __item_t__; static constexpr bool is_random_access_iterator = true; @@ -621,8 +621,8 @@ struct hb_counter_iter_t : void __forward__ (unsigned n) { v += n * step; } void __prev__ () { v -= step; } void __rewind__ (unsigned n) { v -= n * step; } - hb_counter_iter_t __end__ () const { return hb_counter_iter_t (end_, end_, step); } - bool operator != (const hb_counter_iter_t& o) const + hb_range_iter_t __end__ () const { return hb_range_iter_t (end_, end_, step); } + bool operator != (const hb_range_iter_t& o) const { return v != o.v; } private: @@ -644,23 +644,24 @@ struct hb_counter_iter_t : }; struct { - template hb_counter_iter_t - operator () (T start = 0u, S&& step = 1u) const - { return hb_counter_iter_t (start, step >= 0 ? hb_int_max (T) : hb_int_min (T), step); } -} -HB_FUNCOBJ (hb_iota); -struct -{ - template hb_counter_iter_t + template hb_range_iter_t operator () (T end = (unsigned) -1) const - { return hb_counter_iter_t (0, end, 1u); } + { return hb_range_iter_t (0, end, 1u); } - template hb_counter_iter_t + template hb_range_iter_t operator () (T start, T end, S&& step = 1u) const - { return hb_counter_iter_t (start, end, step); } + { return hb_range_iter_t (start, end, step); } } HB_FUNCOBJ (hb_range); +struct +{ + template hb_range_iter_t + operator () (T start = 0u, S&& step = 1u) const + { return hb_range_iter_t (start, step >= 0 ? hb_int_max (T) : hb_int_min (T), step); } +} +HB_FUNCOBJ (hb_iota); + /* hb_enumerate */ struct