Boost logo

Boost :

From: Daniel Spangenberg (dsp_at_[hidden])
Date: 2003-04-24 08:33:36


Recently we tried to compile the boost 1.29 with some of our older Win32
codes using the .NET 7.0
compiler. We got an compiler error due to ambiguities of these overloads
inside the CMap template
implementation header <afxtempl.h>. Does anyone know, whether this is a
problem of the .NET 7.0 library or
some missing overloads in win32.hpp of boost/config/platform? A first
look into the boost 1.30 header
seems to provide the same contents, so I **assume** a similar ambiguity

A mini example reduces to the following code, where the boost config.hpp
header precedes the afxtempl.h

#include <boost/config.hpp>
#include <afxtempl.h>

int main()
 CMap<int, int&, __int64, __int64&> theMap;

The corresponding error message is:

d:\Program Files\Microsoft Visual Studio
.NET\Vc7\atlmfc\include\afxtempl.h(85) : error C2668: 'std::min' :
ambiguous call to overloaded function

could be 'long std::min(long,long)'

or 'long double std::min(long double,long double)'
        while trying to match the argument list '(UINT_PTR, unsigned
        d:\Program Files\Microsoft Visual Studio
.NET\Vc7\atlmfc\include\afxtempl.h(1707) : see reference to function
template instantiation 'void SerializeElements(CArchive &,int
*,INT_PTR)' being compiled
        d:\Program Files\Microsoft Visual Studio
.NET\Vc7\atlmfc\include\atlsimpstr.h(359) : while compiling
class-template member function 'void
CMap<KEY,ARG_KEY,VALUE,ARG_VALUE>::Serialize(CArchive &)'
            ARG_KEY=int &,
            ARG_VALUE=__int64 &
        g:\tmp\todelbflforvc7\BFL\dsptest2\dsptest2.cpp(6) : see
reference to class template instantiation
'CMap<KEY,ARG_KEY,VALUE,ARG_VALUE>' being compiled
            ARG_KEY=int &,
            ARG_VALUE=__int64 &

Currently we work around this uglyness by #include'ing <minmax.h> before

#include'ing <afxtempl.h> and immediately after this we #undef min/max,
but this
is unsatisfactory on the long run.

Thanks in advance,

Daniel Spangenberg

Boost list run by bdawes at, gregod at, cpdaniel at, john at