basic_string<>::_M_mutate

Ryszard Kabatek rysio@rumcajs.chemie.uni-halle.de
Tue Jul 13 01:00:00 GMT 1999


On Mon, 12 Jul 1999, Benjamin Kosnik wrote:

> 
> This and the operator+ stuff in.

You modified my patches a bit, I think my versions was better :-) 

In in my version of _M_mutate _M_state was set to 0 
either automaticly by creating of new _Rep object in 'if block'
or explicit in 'else block'. 
Now if a new _Rep object is created _M_state will be set to 0 again 
at the end of _M_mutate - it is not necessary.

In operator+(_CharT __lhs, const basic_string<>& __rhs)
You did
__str.reserve(__len + sizeof(_CharT));

- reserve takes a number of char_type objects, not bytes, so that

__str.reserve(__len + 1);

is enough.


Ryszard Kabatek
Martin-Luther University Halle-Wittenberg, Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2466 Fax. +49 3461 46 2129



More information about the Libstdc++ mailing list