MSVC2005/icc10.1 boost::date_time std::max 1.34.1

hello, #include <iostream> #include <algorithm> int main() { const double d = std::max(5.0, 6.0); return 0; } This works fine. <algorithm> is supposed to be included to use the max algorithm. <algorithm> comes with VisualC++ headers, which intel uses. The strange thing is that when adding #include <boost/date_time/posix_time/posix_time.hpp> before or after <algorithm> #include <iostream> #include <algorithm> #include <boost/date_time/posix_time/posix_time.hpp> int main() { const double d = std::max(5.0, 6.0); return 0; } 1>.\main.cpp(9): error: expected an identifier 1> const double d = std::max(5.0, 6.0); 1> ^ 1> 1>.\main.cpp(9): error: expected an identifier 1> const double d = std::max(5.0, 6.0); Inclusing of that header seems somehow to damage "max". Gcc4.1/boost doesn't have this problem. any ideas, rds,

AMDG Hicham Mouline <hicham <at> mouline.org> writes:
#include <iostream> #include <algorithm> int main() { const double d = std::max(5.0, 6.0); return 0; } This works fine. The strange thing is that when adding #include <boost/date_time/posix_time/posix_time.hpp> before or after <algorithm>
Inclusing of that header seems somehow to damage "max".
max is defined as a macro by a microsoft header included from windows.h Use (std::max)(5.0, 6.0) In Christ, Steven Watanabe

-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Steven Watanabe Sent: 07 January 2008 17:26 To: boost-users@lists.boost.org Subject: Re: [Boost-users]MSVC2005/icc10.1 boost::date_time std::max 1.34.1
AMDG
Hicham Mouline <hicham <at> mouline.org> writes:
#include <iostream> #include <algorithm> int main() { const double d = std::max(5.0, 6.0); return 0; } This works fine. The strange thing is that when adding #include <boost/date_time/posix_time/posix_time.hpp> before or after <algorithm>
Inclusing of that header seems somehow to damage "max".
max is defined as a macro by a microsoft header included from windows.h
You can #define NOMINMAX To stop this behaviour
Use (std::max)(5.0, 6.0)
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Hicham Mouline
-
Jeff Foster
-
Steven Watanabe