26 explicit RangeIter(T end) : incr(0), cur(end), fin(end) {}
30 : incr(start <= end ? 1 : -1), cur(start), fin(
static_cast<T
>(end + incr)) {}
33 T operator*()
const {
return cur; }
34 bool operator==(
const RangeIter &a)
const {
return cur == a.cur; }
35 bool operator!=(
const RangeIter &a)
const {
return cur != a.cur; }
37 cur =
static_cast<T
>(cur + incr);
41 friend std::ostream &operator<<(std::ostream &,
const RangeIter<U> &);
53static inline RangeIter<T> ReverseRange(std::pair<T, T> p) {
58std::ostream &operator<<(std::ostream &out,
const RangeIter<T> &r) {
60 if (r.cur + r.incr != r.fin) out <<
".." << (r.fin - r.incr);