src/basics.h

changeset 1123
15e46ea3151f
parent 1122
795d1c3554b9
child 1135
8e0691be0b6f
equal deleted inserted replaced
1122:795d1c3554b9 1123:15e46ea3151f
195 return Iterator(EnumLimits<Enum>::First); 195 return Iterator(EnumLimits<Enum>::First);
196 }; 196 };
197 197
198 Iterator end() 198 Iterator end()
199 { 199 {
200 return Iterator(EnumLimits<Enum>::End); 200 return Iterator(EnumLimits<Enum>::Last + 1);
201 } 201 }
202 }; 202 };
203 203
204 template<typename Enum> 204 template<typename Enum>
205 EnumIterShell<Enum> iterateEnum() 205 EnumIterShell<Enum> iterateEnum()
207 return EnumIterShell<Enum>(); 207 return EnumIterShell<Enum>();
208 } 208 }
209 209
210 // Is a value inside an enum? 210 // Is a value inside an enum?
211 template<typename Enum> 211 template<typename Enum>
212 bool valueInEnum(typename std::underlying_type<Enum>::type x) 212 bool valueInEnum(Enum enumerator)
213 { 213 {
214 return x >= EnumLimits<Enum>::First and x <= EnumLimits<Enum>::Last; 214 typename std::underlying_type<Enum>::type index = static_cast<typename std::underlying_type<Enum>::type>(enumerator);
215 return index >= EnumLimits<Enum>::First and index <= EnumLimits<Enum>::Last;
215 } 216 }
216 217
217 double getRadialPoint(int segment, int divisions, double(*func)(double)); 218 double getRadialPoint(int segment, int divisions, double(*func)(double));
218 QVector<QLineF> makeCircle(int segments, int divisions, double radius); 219 QVector<QLineF> makeCircle(int segments, int divisions, double radius);
219 220

mercurial