class chat_session
: public chat_participant,
public boost::enable_shared_from_this
{
.....
void deliver(const chat_message& msg)
{
..................
}
}
class chat_room
{
public:
void join(chat_participant_ptr participant)
{
participants_.insert(participant);
std::for_each(recent_msgs_.begin(), recent_msgs_.end(),
boost::bind(&chat_participant::deliver, participant, _1));
}