Boost logo

Boost Users :

From: Darren Garvey (lists.drrngrvy_at_[hidden])
Date: 2007-08-25 11:46:53


On 25/08/07, Nat Goodspeed <nat.goodspeed_at_[hidden]> wrote:
>
> At 09:51 AM 8/25/2007, kaliwanagan wrote:
>
> >I was just curious as to why the class destructor are (apparently)
> >being called multiple times. I have tried searching the archives to no
> >avail (which prompted me to register and post to the mailinglist).
>
> Try defining an explicit copy constructor with a message like the
> others. I believe the issue is that your object is being passed by
> value, and being copied a few times along the way. You're not seeing
> your no-args constructor message because the other new instances are
> invoking the copy constructor.

One way to avoid it might be using:

void testBoostThread()
{
   boost::thread thrd (boost::ref(testclass)); // pass testclass by
reference
   thrd.join();
}



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