The Ref library is a small library that is useful for passing references to function templates (algorithms) that would usually take copies of their arguments.
from http://www.boost.org/doc/libs/1_53_0/doc/html/boost_asio/example/chat/chat_server.cpp
in call deliver -
void deliver(const chat_message& msg)
{
recent_msgs_.push_back(msg);
while (recent_msgs_.size() > max_recent_msgs)
recent_msgs_.pop_front();
std::for_each(participants_.begin(), participants_.end(),
boost::bind(&chat_participant::deliver, _1, boost::ref(msg)));
}
if the
void deliver(const chat_message& msg)
in another class is taking message by reference then why is boost::ref used at all?