Boost logo

Boost :

From: Ulrich Eckhardt (uli_at_[hidden])
Date: 2004-01-07 10:52:57


On Monday 29 December 2003 22:50, Eric Niebler wrote:
> The MFC file afxtempl.h relies on the max macro, which has been
> #undef'ed by config/platform/win32.hpp.

> error C2668: 'std::max' :
> ambiguous call to overloaded function
> could be 'long std::max(long,long)'
> or 'long double std::max(long double,long double)'

Fix those headers by simply casting to the proper type (i.e. what is on the
left of the assignment, if I remember that place rightly).
Another alternative would be to provide an overload of max() taking a long and
a long double.

> It seems extremely unwise to be undef'ing min and max. Evil though they
> are, many Win32 platform headers (and users' headers!) depend on them,
> and there is simply no way to write a template or set of overloads that
> behave exactly as the macros do.

I still rather fix broken headers and not have makros whos args are evaluated
twice in my programs.

Uli


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk