Is there a way to distinguish between an assigned (possibly expired) weak_ptr and a non-assigned one.
weak_ptr<int> w1;
weak_ptr<int> w2 = ...;
I understand the following checks for either non-assignment or expiry, but is there a (cheaper?) check for only non-assignment?
if (!w.lock()) { /* either not assigned or expired */ }
Aucun commentaire:
Enregistrer un commentaire