class Foo
{
double f1( int x, std::string s1 );
double f2( int x, SomeClass s2 );
}
我希望能够在没有 foo 实例的情况下绑定 Foo.f1 的 s1 以本质上创建
typedef double (Foo::* MyFooFunc)( int )
MyFooFunc func1 = boost::bind( &Foo::f1, _1, _2, "some string" );
MyFooFunc func2 = boost::bind( &Foo::f2, _1, _2, SomeClass );
然后我将 func1 和 func2 作为参数传递给其他函数,其中 Foo 最终被绑定:
void SomeOtherFunction( MyFooFunc func )
{
Foo foo;
boost::function< double (int) > finalFunc =
boost::bind( func, foo, _1 );
}
问题:这可能吗?如果是,1)如何实现呢?2) MyFooFunc 的声明是什么?