132:8a4690db252e | 137:485cb6d6b98c |
---|---|
65 return value == other.value; | 65 return value == other.value; |
66 } | 66 } |
67 | 67 |
68 bool operator!= (const Iterator& other) const | 68 bool operator!= (const Iterator& other) const |
69 { | 69 { |
70 return value != other.value; | 70 return value < other.value; |
71 } | 71 } |
72 | 72 |
73 Iterator& operator++() | 73 Iterator& operator++() |
74 { | 74 { |
75 value += step; return *this; | 75 value += step; return *this; |
88 m_a (T()), | 88 m_a (T()), |
89 m_b (T()) {} | 89 m_b (T()) {} |
90 | 90 |
91 Iterator begin() const | 91 Iterator begin() const |
92 { | 92 { |
93 Iterator it; | 93 return Iterator(min(), m_step); |
94 it.value = min(); | |
95 it.step = m_step; | |
96 return it; | |
97 } | 94 } |
98 | 95 |
99 Iterator end() const | 96 Iterator end() const |
100 { | 97 { |
101 Iterator it; | 98 return Iterator(max(), m_step); |
102 it.value = max() + 1; | |
103 it.step = m_step; | |
104 return it; | |
105 } | 99 } |
106 | 100 |
107 T min() const | 101 T min() const |
108 { | 102 { |
109 return m_a; | 103 return m_a; |
148 { | 142 { |
149 return not operator== (other); | 143 return not operator== (other); |
150 } | 144 } |
151 }; | 145 }; |
152 | 146 |
147 template<typename T> | |
148 Range<T> range(T a, T b, T step = 1) | |
149 { | |
150 return Range<T>(a, b, step); | |
151 } | |
152 | |
153 template<typename T> | |
154 Range<T> range(T b) | |
155 { | |
156 return Range<T>(T(), b); | |
157 } | |
158 | |
153 END_ZFC_NAMESPACE | 159 END_ZFC_NAMESPACE |