This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[libstdc++] Patch for basic_string<>::c_str()
- To: gcc-patches at gcc dot gnu dot org
- Subject: [libstdc++] Patch for basic_string<>::c_str()
- From: Enrico Scholz <Enrico dot Scholz at informatik dot tu-chemnitz dot de>
- Date: 24 Mar 2000 12:03:56 +0100
The current implementation of basic_string<>::c_str() does not follow
the standard and will fail for character-types other than char.
The appended patch solves this problem.
--- std/bastring.h Fri Mar 24 11:57:33 2000
+++ std/bastring.h.orig Fri Mar 24 02:08:09 2000
@@ -332,8 +332,7 @@
public:
const charT* c_str () const
- { static charT const empty_str=eos();
- if (length () == 0) return &empty_str; terminate (); return data (); }
+ { if (length () == 0) return ""; terminate (); return data (); }
void resize (size_type n, charT c);
void resize (size_type n)
{ resize (n, eos ()); }