diff options
author | 2014-08-29 10:41:05 +0200 | |
---|---|---|
committer | 2014-08-29 10:41:05 +0200 | |
commit | e49e84d97940a4201e2b50a2ffe01e66f19ad783 (patch) | |
tree | 3596fef4d6b333986056966f78d04279ccb186cd /test | |
parent | c3e408047427a12669720b64397e080956786829 (diff) |
Added missing STL include of <list> in main.h
Removed duplicated include of <sstream>
Added comments on the background of min/max macro definitions and STL header includes
Diffstat (limited to 'test')
-rw-r--r-- | test/main.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/main.h b/test/main.h index 376232cf2..773873a0d 100644 --- a/test/main.h +++ b/test/main.h @@ -17,13 +17,36 @@ #include <sstream> #include <vector> #include <typeinfo> + +// The following includes of STL headers have to be done _before_ the +// definition of macros min() and max(). The reason is that many STL +// implementations will not work properly as the min and max symbols collide +// with the STL functions std:min() and std::max(). The STL headers may check +// for the macro definition of min/max and issue a warning or undefine the +// macros. +// +// Still, Windows defines min() and max() in windef.h as part of the regular +// Windows system interfaces and many other Windows APIs depend on these +// macros being available. To prevent the macro expansion of min/max and to +// make Eigen compatible with the Windows environment all function calls of +// std::min() and std::max() have to be written with parenthesis around the +// function name. +// +// All STL headers used by Eigen should be included here. Because main.h is +// included before any Eigen header and because the STL headers are guarded +// against multiple inclusions, no STL header will see our own min/max macro +// definitions. #include <limits> #include <algorithm> -#include <sstream> #include <complex> #include <deque> #include <queue> +#include <list> +// To test that all calls from Eigen code to std::min() and std::max() are +// protected by parenthesis against macro expansion, the min()/max() macros +// are defined here and any not-parenthesized min/max call will cause a +// compiler error. #define min(A,B) please_protect_your_min_with_parentheses #define max(A,B) please_protect_your_max_with_parentheses |