From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-12-07 20:38:53
I have sometimes spoken with people here that had an interest in allocators
that could be reset within containers. For example, some have wanted a
One way to solve that problem could be a class like this:
template< class Allocator >
// forward to Allocator* member
And then it can be used like this
typedef external_allocator< std::allocator<T> > ex_allocator;
and can now control the allocator from the outside. There seems to only be a
overhead with this approach.
One usage scenario I
can see would be to use a stack-based allocator on performance critical paths.
(because we need the copy-semantics of the container's allocator to be
If there is interest, I can also add the specified member function to the
or an appropriate member to external_allocator<>.
Feedback is welcome
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk