
12 Jun
2010
12 Jun
'10
6:41 a.m.
Hi there,
Basically, I have a vector of auto_ptrs which is copied into a second vector, thus the first vector's auto_ptr loss their resource and point to nowhere. Basic stuff, as I said. Now, when I try to use an auto_ptr from the first vector using boost::bind everything still works. Meaning the code doesn't fail, although it should. I find that surprising. Why is boost::bind recreating the resource?
It isn't. Boost.Bind passes the arguments by reference, so the auto_ptr is never copied.
All auto_ptrs have been copied a couple of lines before. See the std::copy call. After that my debugger tells me that all auto_ptrs are empty which makes sense. Still not clear to me what exactly happens when using bind. Christian