我想让这段代码正常工作,我该怎么办?
在最后一行给出这个错误。
我究竟做错了什么?我知道 boost::bind 需要一个类型,但我没有。帮助
class A
{
public:
template <class Handle>
void bindA(Handle h)
{
h(1, 2);
}
};
class B
{
public:
void bindB(int number, int number2)
{
std::cout << "1 " << number << "2 " << number2 << std::endl;
}
};
template < class Han > struct Wrap_
{
Wrap_(Han h) : h_(h) {}
template<typename Arg1, typename Arg2> void operator()(Arg1 arg1, Arg2 arg2)
{
h_(arg1, arg2);
}
Han h_;
};
template< class Handler >
inline Wrap_<Handler> make(Handler h)
{
return Wrap_<Handler> (h);
}
int main()
{
A a;
B b;
((boost::bind)(&B::bindB, b, _1, _2))(1, 2);
((boost::bind)(&A::bindA, a, make(boost::bind(&B::bindB, b, _1, _2))))();
/*i want compiled success and execute success this code*/
}