[OpenWalnut-Dev] [WIN32] std::min std::max

Mathias Goldau math at informatik.uni-leipzig.de
Fri Feb 12 11:07:23 CET 2010


Am 20.01.2010 14:45, Mathias Goldau wrote:
> Q: Where are std::min() and std::max()?
> 
> A: The Standard Library defines the two template functions std::min() and
> std::max() in the <algorithm> header. In general, you should use these
> template functions for calculating the min and max values of a pair.
> Unfortunately, Visual C++ does not define these function templates. This is
> because the names min and max clash with the traditional min and max macros
> defined in <windows.h>. As a workaround, Visual C++ defines two alternative
> templates with identical functionality called _cpp_min() and _cpp_max(). You
> can use them instead of std::min() and std::max().To disable the generation of
> the min and max macros in Visual C++, #define NOMINMAX before #including
> <windows.h>.

http://heifner.blogspot.com/2008/02/stdmin-and-stdmax.html give more solutions
on that issue.

greetings Mathias

-- 
Institut für Informatik
Universität Leipzig
Johannisgasse 26, 04103 Leipzig
Phone: +493419732283


More information about the OpenWalnut-Dev mailing list