V
vsgdp
Hi,
I need to pass a member function of the form C::foo(B* b, A& a) to a generic
function:
template<typename Func>
void CLASS2::bar(Func f)
{
...
f(b, a);
}
void C::g()
{
....
class2->bar( C::foo );
}
It does not work. I tried mem_fun, but that also did not work. Effective
STL page 175 gives an example of mem_fun when the function takes no
parameters.
error C2784: 'std::const_mem_fun1_t<_Result,_Ty,_Arg> std::mem_fun(_Result
(__thiscall _Ty::* )(_Arg) const)' : could not deduce template argument for
'overloaded function type' from 'overloaded function type'
I need to pass a member function of the form C::foo(B* b, A& a) to a generic
function:
template<typename Func>
void CLASS2::bar(Func f)
{
...
f(b, a);
}
void C::g()
{
....
class2->bar( C::foo );
}
It does not work. I tried mem_fun, but that also did not work. Effective
STL page 175 gives an example of mem_fun when the function takes no
parameters.
error C2784: 'std::const_mem_fun1_t<_Result,_Ty,_Arg> std::mem_fun(_Result
(__thiscall _Ty::* )(_Arg) const)' : could not deduce template argument for
'overloaded function type' from 'overloaded function type'