1
:ブーストでバインドメンバー関数が必要な理由ブーストdocに
Binding member functions can be done similarly. A bound member function takes in a pointer or reference to an object as the first argument. For instance, given:
struct xyz
{
void foo(int) const;
};
xyz's foo member function can be bound as:
bind(&xyz::foo, obj, arg1) // obj is an xyz object
我々は& XYZ :: fooのだけではなく、XYZ :: fooのを必要とするのはなぜ?
int f(int a, int b)
{
return a + b;
}
std::cout << bind(f, 1, 2)() << std::endl;
このように、&は使用しません。