Home > Archive > VC STL > February 2006 > numeric_limits min max methods conflict with windef.h min max macr
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
numeric_limits min max methods conflict with windef.h min max macr
|
|
| John P. Eurich 2006-02-10, 7:59 am |
| The min and max macros defined in <windef.h> conflicts with the min and max
methods of numeric_limits declared <limits>.
This can happen if <windows.h> is included. Thus, the numeric_limits
examples provided by Microsoft won't work under this condition, e.g.
std::numeric_limits<char>::min()
won't compile correctly.
See:
http://msdn.microsoft.com/library/d...s_Cla
ss_(STL_Sample).asp
The solution is to wrap the full method name in parentheses, e.g.
(std::numeric_limits<char>::min)()
--
jpe
| |
| Ulrich Eckhardt 2006-02-10, 7:03 pm |
| John P. Eurich wrote:
> The min and max macros defined in <windef.h> conflicts with the min and
> max methods of numeric_limits declared <limits>.
[...]
> The solution is to wrap the full method name in parentheses, e.g.
> (std::numeric_limits<char>::min)()
Another way is to "#define NOMINMAX". However, some ATL headers depend on
these broken macros so you might have to "#include <algorithm>" and "using
std::min and std::max" or patch those headers.
Uli
|
|
|
|
|