|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-02-15 07:31:55
Marc Mutz wrote:
> On Wednesday 15 February 2006 01:03, João Abecasis wrote:
>>> C++ question. Use &MyClass::ChildThreadFunction as bind's first
>>> argument. You will probably also run into trouble with passing the
>>> int by reference (why?).
>>
>> Because MyClass::ChildThreadFunc is run in a different thread, in a
>> separate timeline, and when it runs the variable ii may no longer
>> exist (?).
>
> I'm sorry. This wasn't mean to be a GotW-style 'why?', but just
> short for "why did you do it that way?" :)
>
> But thanks nonetheless, yes, that's what I had in mind :)
Note that this is not a problem in this particular case; the reference is
bound to the internal copy of ii that is stored by boost::bind into the
created function object.
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