So it is basically a

 

 

single_thread_shared_ptr_without_weak_ptr_functionality<unique_ptr<T>>

 

Okay, you also differentiate in the type system, who the owner is.

 

 

Would it be an option to define the single_thread_shared_ptr_without_weak_ptr_functionality instead?

 

Basically a pointer to a pair of reference counter + T (with T a unique_ptr, but could be anything).

 

 

I know, you have a concrete usage as pointer in mind, but I am thinking about the underlying building block, whether that makes more sense or has other applications, etc.


 

-----Ursprüngliche Nachricht-----
Von: JOHN MORRISON via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: So 16.02.2025 17: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>;
< Sebastian Wittmeier wrote:
< how about using a pointer to pointer instead?
Hi Sebastian, 
a pointer to a pointer or a reference to the unique_ptr will be good for calling into a function that may zero the owner but not if the owner falls out of scope. It would be left dangling. That is why there is a need for an independently allocated reference counted control block.
 
-- 
 Std-Proposals mailing list
 Std-Proposals@lists.isocpp.org
 https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals