
14 Jul
2005
14 Jul
'05
5:21 a.m.
Hi, a weak_ptr can be said to have three states. 1. Never been assigned to (default constructed) 2. Assigned to, lock will return a shared_ptr to a valid object. 3. Assigned to, but the object pointed to is dead and lock will return null. As far as I know it is currently impossible to distinguish between case 1 and 3. Am I overlooking something? If not, can somebody explain the reason why it is not possible to distinguish the two cases? Admittedly, I cannot come up with any elegant design in which such a distinction is useful, so the question is merely theoretical. Thanks, Jaap Suter