9 Oct
2013
9 Oct
'13
6:09 a.m.
On 09-10-2013 00:44, Gavin Lambert wrote:
On 10/9/2013 3:26 AM, Quoth Thorsten Ottosen:
I suppose there is still a need to break cycles. Why would this have changed.
But part of the semantics of weak_ptr is that it can point to a non-existent (expired) object, which is effectively the same as a null one. And lock() must be able to return an empty pointer, so it would have to be a regular shared_ptr<T> rather than a shared_ptr<*_non_null<T>>. So I'm not sure if a weak_ptr<*_non_null<T>> could make sense.
Or lock() could return something else. Anyway, it could be that just reusing the normal weak ptr would be good. -Thorsten