src/core/math_func.hpp
branchNewGRF_ports
changeset 6872 1c4a4a609f85
parent 6871 5a9dc001e1ad
child 6878 7d1ff2f621c7
--- a/src/core/math_func.hpp	Mon Dec 03 23:39:38 2007 +0000
+++ b/src/core/math_func.hpp	Tue Jan 22 21:00:30 2008 +0000
@@ -1,6 +1,6 @@
-/* $Id */
+/* $Id$ */
 
-/** @file math_func.hpp */
+/** @file math_func.hpp Integer math functions */
 
 #ifndef MATH_FUNC_HPP
 #define MATH_FUNC_HPP
@@ -211,4 +211,16 @@
 	return (uint)(x - min) < (max - min);
 }
 
+/**
+ * Type safe swap operation
+ * @param a variable to swap with b
+ * @param b variable to swap with a
+ */
+template<typename T> void Swap(T& a, T& b)
+{
+	T t = a;
+	a = b;
+	b = t;
+}
+
 #endif /* MATH_FUNC_HPP */