15,980
社区成员




struct closure
{
CUIXXX _Obj;
void* _Func;
};
// 函数对象
template<class T, typename Arg1, typename Return>
class mem_fun1
{
public:
explicit mem_fun1(Return (T::*pfunc)(Arg1))
{
m_pfunc = pfunc;
}
Return operator()(T* pThis, Arg1 _1)
{
return (pThis->*m_pfunc)(_1);
}
Return (T::*m_pfunc)(Arg1);
};
// 函数包
template<class T, typename Arg1, typename Return=long>
class mem_fun1_pkg : public fun_pkg
{
public:
mem_fun1_pkg(mem_fun1<T, Arg1, Return>& mf, T* pThis, Arg1 arg1):m_memberfunction1(mf)
{
m_pThis = pThis;
m_Arg1 = arg1;
}
Return operator()()
{
return m_memberfunction1(m_pThis, m_Arg1);
}
private:
mem_fun1<T, Arg1, Return> m_memberfunction1;
T* m_pThis;
Arg1 m_Arg1;
};