【发布时间】:2014-03-23 15:26:40
【问题描述】:
在这种情况下使用 boost::bind 有什么好处
std::for_each(participants_.begin(), participants_.end(),
boost::bind(&chat_participant::deliver, _1, boost::ref(msg)));
而不是
for(iterator actual = participants_.begin(); actual != participants_.end(); ++actual)
(*actual)->deliver(msg);
Link to the whole code(这是 boost 教程提供的简单服务器示例)。
【问题讨论】: