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]

Re: [Fwd: basic_string<> - useless because of its poor performance]


The current implementation of basic_string is to slow to be useful.
BTW. I implemented the current version of _M_mutate and some other
string modification member functions :-)

I can only recommend again to implement a funcntion, like the one below

size_type 
get_new_capacity(size_type n,
                 size_type max_len) 
{
  if (n > max_len) // OK, we get an exception in _Rep::_S_create
     return n;

  size_type result = n < 17 ? 32 : 2*n;
  return result < max_len ? result : max_len; // Avoiding an exception in _Rep::_S_create
}

that will be called in _M_mutate and perhaps in other places (not in reserve).


I can prepare a patch if you like.

Regards
-- 
Ryszard Kabatek


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