Is unique_ptr guaranteed to store nullptr after move?

Yes, you can compare it to nullptr after the move and it is guaranteed to compare equal.

From ยง20.8.1/4 [unique.ptr]

Additionally, u can, upon request, transfer ownership to another unique pointer u2. Upon completion of such a transfer, the following postconditions hold:
โ€” u2.p is equal to the pre-transfer u.p,
โ€” u.p is equal to nullptr, and

(the member p is described earlier as โ€” a unique pointer is an object u that stores a pointer to a second object p)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)