Use boost::ref(), not just ref().