Hi,
I found a problem in using boost.function with VC++ 10, the
code below reproduces the problem:
#include <boost/function.hpp>
#include <vector>
typedef std::vector<int> test_type;
template<class T>
struct S
{
void
test_g()
{
typedef S<T>
this_class;
boost::function<void (this_class*, test_type)> s(&this_class::g);
}
void
g(test_type){}
};
int main()
{
S<int> s;
s.test_g();
}
This code is OK with VC++ 2008, but with VC++ 2010, it
yields the following message.
Is there anything that I can do to solve the ambiguity? Thanks.
C:\Boost\include\boost-1_39_0\boost/function/function_template.hpp(538)
: error
C2668: 'boost::mem_fn' : ambiguous call to overloaded
function
C:\Boost\include\boost-1_39_0\boost/bind/mem_fn_cc.hpp(25):
could be 'bo
ost::_mfi::mf1<R,T,A1>
boost::mem_fn<void,S<int>,test_type>(R (__thiscall S<int>
::* )(A1))'
with
[
R=void,
T=S<int>,
A1=test_type
]
C:\Program
Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xxmem_fn(32): o
r
'std::tr1::_Mem_fn2<_Rx,_Pmf,_Arg0,_Arg1>
std::tr1::mem_fn<void,S<T>,tes
t_type>(_Rx (__thiscall S<T>::* )(_Arg1))' [found
using argument-dependent looku
p]
with
[
_Rx=void,
_Pmf=void (__thiscall S<int>::* )(test_type),
_Arg0=S<int>,
_Arg1=test_type,
T=int
]
while trying to
match the argument list '(void (__thiscall S<T>::* )(tes
t_type))'
with
[
T=int
]
…..