[iota] end -> end_ to not shadow

This commit is contained in:
Behdad Esfahbod 2019-05-09 10:46:49 -07:00
parent 6bc8257910
commit 71537f93e0
1 changed files with 11 additions and 11 deletions

View File

@ -578,36 +578,36 @@ template <typename T, typename S>
struct hb_iota_iter_t : struct hb_iota_iter_t :
hb_iter_t<hb_iota_iter_t<T, S>, T> hb_iter_t<hb_iota_iter_t<T, S>, T>
{ {
hb_iota_iter_t (T start, T end, S step) : v (start), end (end_for (start, end, step)), step (step) {} hb_iota_iter_t (T start, T end_, S step) : v (start), end_ (end__for (start, end_, step)), step (step) {}
typedef T __item_t__; typedef T __item_t__;
static constexpr bool is_random_access_iterator = true; static constexpr bool is_random_access_iterator = true;
static constexpr bool is_sorted_iterator = true; static constexpr bool is_sorted_iterator = true;
__item_t__ __item__ () const { return v; } __item_t__ __item__ () const { return v; }
__item_t__ __item_at__ (unsigned j) const { return v + j * step; } __item_t__ __item_at__ (unsigned j) const { return v + j * step; }
bool __more__ () const { return v != end; } bool __more__ () const { return v != end_; }
unsigned __len__ () const { return (end - v) / step; } unsigned __len__ () const { return (end_ - v) / step; }
void __next__ () { v += step; } void __next__ () { v += step; }
void __forward__ (unsigned n) { v += n * step; } void __forward__ (unsigned n) { v += n * step; }
void __prev__ () { v -= step; } void __prev__ () { v -= step; }
void __rewind__ (unsigned n) { v -= n * step; } void __rewind__ (unsigned n) { v -= n * step; }
hb_iota_iter_t __end__ () const { hb_iota_iter_t (end, end, step); } hb_iota_iter_t __end___ () const { hb_iota_iter_t (end_, end_, step); }
bool operator != (const hb_iota_iter_t& o) const bool operator != (const hb_iota_iter_t& o) const
{ return v != o.v || end != o.end || step != o.step; } { return v != o.v || end_ != o.end_ || step != o.step; }
private: private:
static inline T end_for (T start, T end, S step) static inline T end__for (T start, T end_, S step)
{ {
auto res = (end - start) % step; auto res = (end_ - start) % step;
if (!res) if (!res)
return end; return end_;
end += step - res; end_ += step - res;
return end; return end_;
} }
private: private:
T v; T v;
T end; T end_;
S step; S step;
}; };
struct struct