Date: Sun, 16 Feb 2025 19:21:47 +0100
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. Non-threadsafe.
-----Ursprüngliche Nachricht-----
Von:JOHN MORRISON via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:So 16.02.2025 18:50
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: I am just thinking, whether the implicitly contained unique_ptr in your solution should/could be made explicit (e.g. as template argument) instead.
If I understand your question, the simple way to make the implicit unique_ptr in notifying_unique_ptr more explicit would be to not use the notifying_unique_ptr using declaration and write what it represents instead. So instead of writing xnr::notifying_unique_ptr<T, D> you would write std::unique_ptr<T, xnr::notify_ptrs<T, D>>. It is more verbose but that also makes it more transparent about what it is. It isn't hard to guess what is going on - a deleter called notify_ptrs. It could also be more reassuring in code reviews to see that trusted std::unique_ptr explicitly visible.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-02-16 18:26:06