如何在一系列 boost::function 对象上使用 std::for_each ?
class User
{
public:
User(){}
virtual ~User(){}
void Test( int in )
{
}
}
User user;
vector< boost::function< void() > > functions;
functions.push_back( boost::bind( &User::Test, &user, 2 ) );
functions.push_back( boost::bind( &User::Test, &user, 4 ) );
for_each( functions.begin(), functions.end() , /* What goes here? */ );
class User
{
public:
User(){}
virtual ~User(){}
void Test( int in )
{
}
}
User user;
vector< boost::function< void() > > functions;
functions.push_back( boost::bind( &User::Test, &user, 2 ) );
functions.push_back( boost::bind( &User::Test, &user, 4 ) );
for_each( functions.begin(), functions.end() , /* What goes here? */ );
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
将
mem_fn
设为std::tr1::mem_fn
或boost::mem_fn
。Try
Where
mem_fn
is eitherstd::tr1::mem_fn
orboost::mem_fn
.