Date: Sun, 16 Feb 2025 21:06:58 +0000
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.
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.
Received on 2025-02-16 21:07:01