C
Christopher
Reading on the boost pointer types, it almost sounds as if
I should always use a shared_ptr when dealing with something that is
allocated on the heap and owned
I should always use a weak_ptr when dealing with something that is
allocated on the heap, but not owned
In what cases should I be using a weak_ptr vs passing by reference?
As is, I am inclined to start replacing all those class methods that
take a reference to an object whose lifetime is managed by another
class with methods that create a weak_ptr instead. Before I do that is
there anything that I should know about using a weak_ptr vs simply
passing a reference down the line?
I should always use a shared_ptr when dealing with something that is
allocated on the heap and owned
I should always use a weak_ptr when dealing with something that is
allocated on the heap, but not owned
In what cases should I be using a weak_ptr vs passing by reference?
As is, I am inclined to start replacing all those class methods that
take a reference to an object whose lifetime is managed by another
class with methods that create a weak_ptr instead. Before I do that is
there anything that I should know about using a weak_ptr vs simply
passing a reference down the line?