This is the mail archive of the libstdc++@sourceware.cygnus.com 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: bug in string::substr?



I cannot reproduce your crasher with either gcc-2.95.2 + libstdc++-v2 or
gcc-2.95.2 + libstdc++-v3. I get

> string x="abc";
> string y;
> 
> y=x.substr(1,0);

y is an empty string here, as this ctor is being used:

  template<typename _CharT, typename _Traits, typename _Alloc>
    basic_string<_CharT, _Traits, _Alloc>::
    basic_string(const basic_string& __str, size_type __pos, size_type __n)

The size of the string is zero, thus y == empty. 

Perhaps you had something else in mind?

-benjamin

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