May 21, 2008
I’m continuing to discover the wonder of boost. Yesterday it was boost::lexical_cast(), a very neat way to do those peskly int to string conversions. Today, it’s boost::cref(). Why did I need it ? I’m using boost::bind() to marshall parameters for dispatch across a thread boundary. All well and good til one of the parameters inherited from boost::noncopyable. Wrap the noncopyable in a boost::cref() invocation, and all is well again.
Apparently, boost::cref converts the reference to a pointer under the covers. Ironic, non ?