int main()
{
A a(10);
std::cout << "...f1..." << std::endl;
boost::bind(&f, a)();
std::cout << "...f2..." << std::endl;
boost::bind(&f, boost::ref(a))();
std::cout << "...g1..." << std::endl;
boost::bind(&g, a)();
std::cout << "...g2..." << std::endl;
boost::bind(&g, boost::ref(a))();
return 0;
}
输出:
A()
...f1...
A(const A&)
A(const A&)
A(const A&)
A(const A&)
A(const A&)
A(const A&)
f(A)
...f2...
A(const A&)
f(A)
...g1...
A(const A&)
A(const A&)
A(const A&)
A(const A&)
A(const A&)
g(A&)
...g2...
g(A&)