src/generics/functions.h

changeset 1320
bdb4804bc09c
parent 1319
39d7a9642eea
child 1322
d8935cdb24c0
--- a/src/generics/functions.h	Sat Mar 24 11:57:24 2018 +0200
+++ b/src/generics/functions.h	Sat Mar 24 12:06:22 2018 +0200
@@ -4,11 +4,14 @@
 #include "../basics.h"
 
 using std::abs;
+using std::atan2;
 using std::ceil;
 using std::cos;
 using std::floor;
 using std::hypot;
+using std::pow;
 using std::sin;
+using std::sort;
 using std::sqrt;
 
 /*
@@ -26,6 +29,18 @@
 	return (::abs(a - ::floor(a)) < 0.00001) or (::abs(a - ::ceil(a)) < 0.00001);
 }
 
+template<typename T>
+T squared(T value)
+{
+	return ::pow(value, 2);
+}
+
+template<>
+inline int squared<int>(int value)
+{
+	return value * value;
+}
+
 //
 // Returns true if first arg is equal to any of the other args
 //

mercurial