Cool, thanks! I thought I was missing something. I think I have to use
shared_ptr then, because my code is shared among various parallel
OpenMP workers... I'll post here again if my parallelization doesn't
work out. The arrays are sliced, but I have other data structures
which keep track of these slices, and those are better off with
shared_ptr IMO.
Max
On Thu, Jul 29, 2010 at 5:10 AM, Patrick Loney
Can I still pass that pointer by value into a function like I did with shared_ptr in the above example?
No, you can't take a copy of a scoped ptr, when one goes out of scope it automatically causes the pointed to object to destruct, if there are two scoped ptrs pointing to the same object what would happen when the second is then used to access the already destructed object? You can pass scoped ptrs by reference, use shared pointers when you want multiple objects to have ownership of the pointed to object (i.e. no object can destroy the contents of the shared pointer while another object still needs it). _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users