Circumventing __USE_MALLOC and templatized containers
Carlo Wood
carlo@alinoe.com
Fri Nov 16 10:20:00 GMT 2001
On Mon, Nov 26, 2001 at 11:22:29AM +0100, Wolfgang Bangerth wrote:
> use. That's why I asked how people solve these problems?
Thanks. Imho, the need to replace allocators has been
underestimated or even neglected. I've had this problem
too and found no satisfactory solution: it is not possible
to replace the (default) allocator without practically
having to rewrite the STL and ending up with a totally
incompatible set of STL containers etc.
In my case I fortunately only needed a very limited
number of variations (I only store 'char' in the containers),
so I "solved" things by creating non-templated types like
typedef ::std::basic_string<char, ::std::char_traits<char>, internal_allocator> internal_string;
however, I also used
template <typename T>
struct internal_vector : public ::std::vector<T, typename internal_allocator::rebind<T>::other>
{ };
only using the default constructor of internal_vector
anywhere else in my application.
--
Carlo Wood <carlo@alinoe.com>
More information about the Libstdc++
mailing list