C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A non-owning but self zeroing smart pointer for single ownership

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Sun, 16 Feb 2025 17:31:50 +0100
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_at_[hidden]> 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_at_[hidden]; CC:JOHN MORRISON <inglesflamenco_at_[hidden]>; < 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_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-02-16 16:36:08