From a63fea570a599eeb662fc63f0116bf989ab9a2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 13 May 2013 12:05:42 +0200 Subject: [PATCH] Math: don't include in header file. 31ce072f39513277a70d1d3611814cdc0a261635 was wrong, this header is harmful. This beast includes ~46k LOC, much more than <*stream> class of headers. Rewritten min() and max() manually, which surprisingly leads to shorter implementation than previously. Compilation time on my machine reduced from ~4:30 to ~4:21, not bad. --- src/Math/Functions.h | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/Math/Functions.h b/src/Math/Functions.h index 09a1a130a..ed944ca58 100644 --- a/src/Math/Functions.h +++ b/src/Math/Functions.h @@ -26,7 +26,6 @@ #include #include -#include /* for std::min(std::initializer_list) */ #include #include "Math/Vector.h" @@ -142,19 +141,12 @@ template inline Vector min(const Vector inline T min(std::initializer_list list); -#else -template inline typename std::enable_if::value, T>::type min(std::initializer_list list) { - return std::min(std::move(list)); -} -template inline Vector min(std::initializer_list> list) { - Vector out(*list.begin()); +template inline T min(std::initializer_list list) { + T out(*list.begin()); for(auto it = list.begin()+1; it != list.end(); ++it) out = min(out, *it); return out; } -#endif /** @brief Maximum @@ -176,19 +168,12 @@ template Vector max(const Vector& a #endif /** @overload */ -#ifdef DOXYGEN_GENERATING_OUTPUT -template inline T max(std::initializer_list list); -#else -template inline typename std::enable_if::value, T>::type max(std::initializer_list list) { - return std::max(std::move(list)); -} -template inline Vector max(std::initializer_list> list) { - Vector out(*list.begin()); +template inline T max(std::initializer_list list) { + T out(*list.begin()); for(auto it = list.begin()+1; it != list.end(); ++it) out = max(out, *it); return out; } -#endif /** @brief Sign