209 bool isInteger (T a) |
210 bool isInteger (T a) |
210 { |
211 { |
211 return (qAbs (a - floor(a)) < 0.00001) or (qAbs (a - ceil(a)) < 0.00001); |
212 return (qAbs (a - floor(a)) < 0.00001) or (qAbs (a - ceil(a)) < 0.00001); |
212 } |
213 } |
213 |
214 |
214 template<typename T> |
|
215 void removeDuplicates (T& a) |
|
216 { |
|
217 std::sort (a.begin(), a.end()); |
|
218 a.erase (std::unique (a.begin(), a.end()), a.end()); |
|
219 } |
|
220 |
|
221 // |
215 // |
222 // Returns true if first arg is equal to any of the other args |
216 // Returns true if first arg is equal to any of the other args |
223 // |
217 // |
224 template<typename T, typename Arg, typename... Args> |
218 template<typename T, typename Arg, typename... Args> |
225 bool isOneOf (T const& a, Arg const& arg, Args const&... args) |
219 bool isOneOf (T const& a, Arg const& arg, Args const&... args) |