
Custom deleters are your friend.
How about custom allocators AND deleters?
The reason I say this is because it would be useful to have a policy-based approach when interacting with APIs that do the allocation/destruction. But instead of placing two pointers(1 for allocator + 1 for deleter) why not use a virtual function table for both? In other words, instead of just having a sp_counted_base::dispose + destruct, why not add an virtual allocate? Then, instead of passing the deleter as an argument to the CTOR, a sp_counted_base* would be passed and the user would define a subclass of sp_counted_base which used whatever allocator and destructor desired. This would save some memory and wouldn't (I don't think) constrain the user much since I don't think the user would want a separate destructor and allocator for each instance of
On 02/02/2004 10:32 AM, Javier Estrada wrote: the shared object.