Am Samstag, 18. November 2006 10:55 schrieb Jean-Marc Lasgouttes:
> >>>>> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> 
writes:
> 
> Andre> I don't understand the difference.
> 
> Easy: the new one works :)
> 
> More precisely, the string is now a docstring and tricks with
> null-terminated strings are not working anymore.

For me the old version works, too (gcc 4.1.2). In theory the docstring vs. 
std::string does not make any difference here. std::basic_string is not 
required to terminate the string with 0 (but the recent gcc libstdc++ 
does, see for example 
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01777.html, because c_str() 
is required to return a 0-terminated string). Fact is that

str_.resize(3);
str_[0] = '#';
str_[1] = static_cast<char_type>('0' + n);
str_[2] = '\0';

is beyond the standard. If it would make sense at all resize(2) should be 
used.

> If your problem is 
> with the use of convert, it may be possible to do something else.

Please not. We have convert for exactly these cases.


Georg

Reply via email to