So far, we have established that it should only be used within a single thread (and a second proposal could suggest a thread safe alternative based on shared_ptr/weak_ptr making it unique instead of shared). In that case it does not make sense having a stack variable (i.e. a variable in local function scope) as ptr_to_unique. Your motivating example should not show this. The only use case for this type (as I see it) is to use ptr_to_unique as member variable. This is the only use case where in a single threaded context (or multi threaded, but the other threads don’t have anything to do with this unique_ptr) the pointer can be zeroed out while the ptr_to_unique still exists. (Other use cases could be global or static variables. I’m not sure these are the correct motivation.)
-- Std-Proposals mailing listStd-Proposals@lists.isocpp.orghttps://lists.isocpp.org/mailman/listinfo.cgi/std-proposals