Hi John,

how about using a pointer to pointer instead?
 

-----Ursprüngliche Nachricht-----
Von: JOHN MORRISON via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: So 16.02.2025 16:11
Betreff: Re: [std-proposals] A non-owning but self zeroing smart pointer for single ownership
An: std-proposals@lists.isocpp.org;
CC: JOHN MORRISON <inglesflamenco@hotmail.com>;
 
Yes that is correct. p1 would be a unique_ptr and p2 would be a ptr_to_unique. With a pure function that has no access to the ownership of p1, p2 can be just a raw pointer. However if is is some kind of framework function that can affect the ownership of p1 then you would pass in p2 as a ptr_to_unique and test it after any action or call that might touch the ownership of p1.
 
Mainly it is intended for persistent pointers like class members but yes, there are situation where you might use it as an argument type or local variable.
 
 
-- 
 Std-Proposals mailing list
 Std-Proposals@lists.isocpp.org
 https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals