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@lists.isocpp.org>
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@lists.isocpp.org;
CC: JOHN MORRISON <inglesflamenco@hotmail.com>;
 
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@lists.isocpp.org
 https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals