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: [FYI] Forward movement on 9404


Nathan Myers wrote:

Yes. First, clean up the __testout tests:

 if (__builtin_expect(!__testout, false))
   return traits_type::eof();
 if (__builtin_expect(__testeof, false))
   return traits_type::not_eof();

 __size_type __len = std::max(this->_M_buf_size, this->_M_buf_size_opt);
 __len *= 2;

 if (__builtin_expect(!__testwrite && __len > _M_string.max_size(), false))
   return traits_type::eof();
 if (!__testwrite)
   {
     // Force-allocate, re-sync
     ...
   }
 return this->sputc(traits_type::to_char_type(__c));

Great! I'm incorporating this contribution of yours in the patch.

But can we let the basic_string<> figure out a new length for itself,
and allocate and copy, by calling capacity(__len)?

Indeed.
Especially so now that basic_string<> is able to grow exponentially.
Will try to look into this today and repost something closer to the
final version today or tomorrow.

Thanks,
Paolo.


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