20 Feb
2007
20 Feb
'07
7:10 p.m.
Darren Garvey wrote:
Hi,
I'm trying to use bood::bind and I'm having a problem with compilation when I'm passing an object that holds a std::stringstream. The errors are to do with std::ios_base and std::streambuf's copy constructors being private, but as far as I knew (and understand from the docs), boost::bind passes by reference, so nothing should be copied.
No, boost::bind( f, x, y... ) stores copies of f, x and y. Use ref(h) to make it store a reference. See the last paragraph of http://boost.org/libs/bind/bind.html#with_functions You might also consider using shared_ptr<holder> unless you have the lifetime issues already figured out.