Original Post
i'm using boost::smart_ptr for all my objects and it works fine so far. but there are objects whose creation, access and deletion i want to control with special managers who hold all these objects - a resource manager that allocates resources, a sound manager that loads and plays sound sources etc. but if i use smart_ptr's for objects controlled by these managers, i cannot control their deletion. so should i just use regular pointers for objects whose creating, access and deletion is taken care of by managers, or is there a safer alternative? i guess this is what weak_ptr is for, but i'm not sure how to use that in such a case. also i'm not sure how to return objects managed by smart_ptr. let's say we have the following ina class definition:
smart_ptr<Object> GetObject()
{
return m_Object;
}
smart_ptr<Object> m_Object;is this the right way to return a pointer to m_Object? or should GetObject() return a reference to the smart_ptr?