Is the following a good way of describing ownership intent (without using shared_ptr?)
class Z { };
class A
{
unique_ptr<Z> m_z; //want to say 'I own Z'
};
class B
{
B(A & a)
{
m_z = a._z.get();
}
Z* m_z; //want to say 'I do not own Z, just a ref...'
}
Also, B._z can be dangling. Is there a way to rectify the problem without resorting to shared_ptr and weak_ptr?