title: why is this program using boost::ref
body: <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>from <a href="http://www.boost.org/doc/libs/1_53_0/doc/html/boost_asio/example/chat/chat_server.cpp" rel="nofollow">http://www.boost.org/doc/libs/1_53_0/doc/html/boost_asio/example/chat/chat_server.cpp</a></p>
  
  <p>in 
  call deliver -</p>
  
  <pre><code>  void deliver(const chat_message&amp; msg)
    {
      recent_msgs_.push_back(msg);
      while (recent_msgs_.size() &gt; max_recent_msgs)
        recent_msgs_.pop_front();
  
      std::for_each(participants_.begin(), participants_.end(),
          boost::bind(&amp;chat_participant::deliver, _1, boost::ref(msg)));
    }
  </code></pre>
  
  <p>if the </p>
  
  <pre><code>void deliver(const chat_message&amp; msg)
  </code></pre>
  
  <p>in another class is taking message by reference then why is boost::ref used at all?</p>