C
Christopher
If I have a factory that is allocating objects and returning them from
one of its methods, what kind of smart pointer should I be using?
I would normally use an std::auto_ptr, but was told that it is not as
"safe" as a boost pointer. So, I looked at boost and thought a scoped
pointer was a good fit, but it cannot be copied. My factory has a
number of these things that it allocates and stored in a vector until
the are retrieved.
So, should I be using a boost shared_ptr then? Even though only one
class will be dealing with the allocated object at a time?
one of its methods, what kind of smart pointer should I be using?
I would normally use an std::auto_ptr, but was told that it is not as
"safe" as a boost pointer. So, I looked at boost and thought a scoped
pointer was a good fit, but it cannot be copied. My factory has a
number of these things that it allocates and stored in a vector until
the are retrieved.
So, should I be using a boost shared_ptr then? Even though only one
class will be dealing with the allocated object at a time?