Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-12-22 10:37:58


Tobias Schwinger wrote:
> John Maddock wrote:
>> Tobias Schwinger wrote:
>>> If we use a custom Allocator we'll also need a custom Smart Pointer
>>> that uses this Allocator. None of our Boost Smart Pointers support
>>> Allocators and the Factory should actually initialize a stateful
>>> Allocator within a Smart Pointer that does.
>>
>> Doesn't shared_ptr support a custom deleter? A custom deleter is
>> just an allocator by another name/interface IMO...
>
> Thanks!
>
> Well, this feature of 'shared_ptr' sets the situation into a different
> light (is it new?)...

I don't think so, it's certainly extremely useful, as amounst other things
supplying a custom deleter doesn't change the pointer type :-)

> I'm considering a (partial) specialization for the Allocator template
> parameter, assuming a second constructor parameter for Smart Pointers
> in case 'Allocator' is not void (figuring 'std::allocator' is still an
> Allocator and should be treated as such).

I think that's correct: some std::allocators may do more than just call
::new, I don't know if it still does, but STLport's used to cache memory for
example.

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net