summaryrefslogtreecommitdiff
path: root/src/compat/alg.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compat/alg.hpp')
-rw-r--r--src/compat/alg.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/compat/alg.hpp b/src/compat/alg.hpp
new file mode 100644
index 0000000..250c161
--- /dev/null
+++ b/src/compat/alg.hpp
@@ -0,0 +1,21 @@
+#ifndef TMWA_COMPAT_ALG_HPP
+#define TMWA_COMPAT_ALG_HPP
+
+# include "../sanity.hpp"
+
+# include <type_traits>
+
+
+template<class A, class B>
+typename std::common_type<A, B>::type min(A a, B b)
+{
+ return a < b ? a : b;
+}
+
+template<class A, class B>
+typename std::common_type<A, B>::type max(A a, B b)
+{
+ return b < a ? a : b;
+}
+
+#endif // TMWA_COMPAT_ALG_HPP