ambiguity of function "min"

I migrated my platform from version 6 to 8. Then the following error occurs. Actually, I can comment out my definition to make it work. I just don't understand why c:\program files\microsoft visual studio 8\vc\include\xutility is included I didn't include it by myself. Is this a system header How can I disable this header

Thanks!

c:\source\fixedpoint.h(27) : error C2668: 'min' : ambiguous call to overloaded function
c:\panliu1\wcdma\hsdpa\wcdma_hsdpa_platform_bs\source\global.h(274): could be 'T min<double>(T,T)'
with
[
T=double
]
c:\program files\microsoft visual studio 8\vc\include\xutility(2951): or 'const _Ty &std::min<double>(const _Ty &,const _Ty &)'
with
[
_Ty=double
]
while trying to match the argument list '(double, double)'




Answer this question

ambiguity of function "min"

  • JIM.H.

    <xutility> is a subordinate header to other Standard C++ Library headers that you are currently using. I wouldn't worry about its inclusion.

    If your own definition in global.h is redundant, then I'd go ahead and comment that out as you mentioned. If you still need it, then the classic resolution to your situation is to wrap it in your own namespace, and qualify min with it:

    e.g.
    double x = 0, y = 1;
    double z = my_namespace::min( x, y );


  • ambiguity of function "min"