This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: bug in string::substr?
- To: "Gerd v. Egidy" <egidy at deam dot de>
- Subject: Re: bug in string::substr?
- From: Benjamin Kosnik <bkoz at cygnus dot com>
- Date: Thu, 18 Nov 1999 17:16:56 -0800 (PST)
- cc: libstdc++ at sourceware dot cygnus dot com
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