Date: Mon, 17 Feb 2025 08:41:09 +0100
Hi John,
you want to introduce a new smart pointer to the language. The existing ones support flexible resources beyond memory with custom deleters.
Your smart pointer does not have to, it is your proposal after all, but it should be a conscious decision and those are design decisions to consider during standardization, even if they were not your initial use case.
With standardization it is less important, if the possible implementation is simple, but whether usage is simple.
Part of usage is reasoning about it, and you say, it is easier to reason as extension of unique_ptr instead of a separate class. Maybe, maybe not.
-----Ursprüngliche Nachricht-----
Von:JOHN MORRISON via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:So 16.02.2025 22:07
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 wrote: It is possible to change the order of the types So that unique_ptr is the template argument instead of notify_ptrs. In that way it would work with any resource. It would be an efficient reference-counted abstraction for any object with ownership semantics.
Hi Sebastian,
I think what you are talking about here is way outside the scope of what I'm trying to do. You seem to be talking about a more generic approach that leverages notify_ptrs to manages a wider range of ownership possibilities. But notify_ptrs is strongly wedded to the structure of unique_ptr and would not work for instance with shared_ptr. Neither would I want it to because we already have weak_ptr that.
I would not want to change the order of the types because that would only further obscure the fact that what you have is just the well trusted unique_ptr with a deleter hook.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-02-17 07:45:24