здесь: http://www.boost.org/doc/libs/1_53_0/doc/html/boost_asio/example/chat/chat_server.cppКак перебрать элементы в std :: set/add условие в std :: for_each через std :: set в vs2008?
std::set<chat_participant_ptr> participants_;
....
participants_.insert(participant);
....
void deliver(const chat_message& msg, chat_participant_ptr participant)
{
recent_msgs_.push_back(msg);
while (recent_msgs_.size() > max_recent_msgs)
recent_msgs_.pop_front();
// I want to call the deliver method on all members of set except the participant passed to this function, how to do this?
std::for_each(participants_.begin(), participants_.end(),
boost::bind(&chat_participant::deliver, _1, boost::ref(msg)));
}
Я хочу, чтобы вызвать метод доставки всех членов набора, за исключением участника, переданного этой функции, как сделать это в VS2008?
Я получаю отсутствующий спецификатор типа при авто –
Вы компилируете с C++ 11? Если нет (и если вы не можете включить его), это всего лишь компактный способ записи регулярного цикла 'for', итерации по набору. – Useless
no I m not, что я должен делать в таком случае? –