Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-02-20 14:10:58


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net