Boost logo

Boost :

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


Hello!

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
there.

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

#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

g:\tmp\todelbflforvc7\ThirdParty\boostBase\boostInclude\boost\config\platform\win32.hpp(60):
could be 'long std::min(long,long)'

g:\tmp\todelbflforvc7\ThirdParty\boostBase\boostInclude\boost\config\platform\win32.hpp(69):
or 'long double std::min(long double,long double)'
        while trying to match the argument list '(UINT_PTR, unsigned
int)'
        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 &)'
        with
        [
            KEY=int,
            ARG_KEY=int &,
            VALUE=__int64,
            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
        with
        [
            KEY=int,
            ARG_KEY=int &,
            VALUE=__int64,
            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 acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk