This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: std::string allocator


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]