|
Boost Users : |
From: Edward Diener (eddielee_at_[hidden])
Date: 2002-07-13 09:28:05
Is there any way to use boost::function and member function pointers with
VC6 . I realize it is deficient in partial specialization but I was still
hoping to be able to use it. All my attempts to compile meet with failure
although the compiler tests say that VC6 succeeds both with boost::function
and boost::bind.
If I try the bind1st.cpp example in libs\function\example directory I get
the error:
error C2784: 'class std::mem_fun_t<_R,_Ty> __cdecl std::mem_fun(_R
(__thiscall _Ty::*)(void))' : could not deduce template argument for
'<Unknown>' from 'int (__thiscall X::*)(int)'
If I try some code of my own and use boost::bind instead, I get an error:
error C2780: 'class boost::_bi::bind_t<R,class
boost::_mfi::cmf8<R,T,B1,B2,B3,B4,B5,B6,B7,B8>,class boost::_bi::list9<class
boost::_bi::value<R>,class boost::_bi
::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class
boost::_bi::value<R>,class boost::_bi::value<R>,class
boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> >
> __cdecl boost::bind(R (__thiscall T::*)(B1,B2
,B3,B4,B5,B6,B7,B8) const,A1,A2,A3,A4,A5,A6,A7,A8,A9)' : expects 10
arguments - 2 provided
My own code is:
#include "stdafx.h"
#include <boost\function.hpp>
#include <boost\bind.hpp>
class MyClass
{
public:
int MyMember(int,int,int);
};
int MyClass::MyMember(int x,int y,int z)
{
int a = x + y + z;
}
int main(int argc, char* argv[])
{
MyClass mcl;
boost::function3<int,int,int,int> bf;
bf = boost::bind(&MyClass::MyMember,&mcl);
bf(2,3,4);
return 0;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net