This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Small tweak to a string::operator+


Hi,

no need to go through the very general append taking two
iterators.

Tested x86-linux, committing to mainline.

Paolo.

/////////////
2004-01-24  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/basic_string.tcc (operator+(const _CharT*,
	const basic_string&)): No need to go through the append
	taking two iterators.
diff -urN libstdc++-v3-orig/include/bits/basic_string.tcc libstdc++-v3/include/bits/basic_string.tcc
--- libstdc++-v3-orig/include/bits/basic_string.tcc	2004-01-24 17:25:07.000000000 +0100
+++ libstdc++-v3/include/bits/basic_string.tcc	2004-01-24 18:20:53.000000000 +0100
@@ -683,7 +683,7 @@
       const __size_type __len = _Traits::length(__lhs);
       __string_type __str;
       __str.reserve(__len + __rhs.size());
-      __str.append(__lhs, __lhs + __len);
+      __str.append(__lhs, __len);
       __str.append(__rhs);
       return __str;
     }

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