This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: std::string allocator
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Stefan Olsson <stefan at garcio dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Mon, 06 Mar 2006 16:37:13 +0100
- Subject: Re: std::string allocator
- References: <20060206162048.stefan@garcio.com.12>
Stefan Olsson wrote:
>Hi folks,
>
>back with a new allocator related issue. Downloaded 4.1.0 and compiled with:
>--enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --host=i386-redhat-linux --enable-libstdcxx-allocator=mt --enable-languages=c,c++
>
>This way I can enjoy the performance of mt_alloc without having to specify it every time (or rather set up a global define for each type). Not quite though...
>...the std::string is defined in bits/stringfwd.h as:
>typedef basic_string<char> string;
>
>
Then string uses std::allocator<_CharT>, and since you passed
--enable-libstdcxx-allocator=mt at build time, the implementation of
std::allocator *is* mt_allocator:
template<typename _Tp>
class allocator: public __glibcxx_base_allocator<_Tp>
...
I don't understand...
Paolo.