From: John Max Skaller (skaller_at_[hidden])
Date: 2001-05-12 07:08:09
The flx allocator currently requires a 'custom' allocator
to be supplied, and cannot be used by standard library
containers where allocators are required.
I was looking at changing it to accept a ISO C++ Standard
allocator, and to look like one too, to fix this problem.
Unfortunately, the Standard allocator design is seriously
broken. I wonder if there is any interest in
a boost version of STL containers (and a version
of the default allocator) that fixes this problem.
The fix is:
1. remove allocator default constructors
2. provide the member template copy<U>
which returns an associate allocator for type U
3. Replace every use of
in every STL container with
This does mean copying the whole of STL :-)
The basic problem is that allocators must use global
variables because of the default constructor.
The 'copy' member solves this problem, for example
allowing a pointer to a physically allocator object
or storage to be suballocated to be copied.
Without this change, it is impossible to do
implement certain allocators: for example
the fastest allocator available is a stack,
for which deallocate() does nothing, but
destroying the allocator object destroys all
the storage at once. You can have exactly
one of these with the current allocator design,
which is not tenable.
The principal use of the revised allocators is to
allow non-thread-safe allocators to be use by threads
by creating an allocator for each thread.
[A different, thread safe, locking kind of allocator
is used for shared objects]
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk