The acceleration library provides a copy mechanism that helps transfer information about an object to a new topic. In another example, boost boost :: bind will be copied using a pointer, which is also just copied. Therefore, you will have to take care of the validity of your object to prevent the dangling pointer. If you implement the operator () and instead create a copy constructor and pass the object directly, you do not need to take care of it.
A nicer solution that prevents a lot of trouble:
MyClass clazz(1);
Another example of boost creates a thread object on the heap, although that doesn't make sense.
CSpille May 11 '10 at 16:29 2010-05-11 16:29
source share