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.