diff -urN libstdc++-v3-orig/include/bits/basic_string.h libstdc++-v3/include/bits/basic_string.h --- libstdc++-v3-orig/include/bits/basic_string.h Wed Mar 6 22:22:52 2002 +++ libstdc++-v3/include/bits/basic_string.h Mon Mar 25 02:19:08 2002 @@ -647,8 +647,8 @@ || less()(_M_data() + __size, __s)) return _M_replace_safe(_M_ibegin() + __pos, _M_ibegin() + __pos + __foldn1, __s, __s + __n2); - else return this->replace(_M_check(__pos), _M_fold(__pos, __n1), - __s, __s + __n2); + else return replace(_M_check(__pos), _M_fold(__pos, __n1), + basic_string(__s, __s + __n2)); } basic_string& @@ -682,6 +682,27 @@ { return _M_replace(__i1, __i2, __k1, __k2, typename iterator_traits<_InputIterator>::iterator_category()); } + basic_string& + replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2) + { return this->replace(__i1 - _M_ibegin(), __i2 - __i1, + reinterpret_cast(__k1), __k2 - __k1); } + + basic_string& + replace(iterator __i1, iterator __i2, const _CharT* __k1, const _CharT* __k2) + { return this->replace(__i1- _M_ibegin(), __i2 - __i1, __k1, __k2 - __k1); } + + basic_string& + replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2) + { return this->replace(__i1 - _M_ibegin(), __i2 - __i1, + reinterpret_cast(&*__k1), __k2 - __k1); + } + + basic_string& + replace(iterator __i1, iterator __i2, const_iterator __k1, const_iterator __k2) + { return this->replace(__i1 - _M_ibegin(), __i2 - __i1, + reinterpret_cast(&*__k1), __k2 - __k1); + } + private: template basic_string& @@ -690,8 +711,8 @@ template basic_string& - _M_replace_safe(iterator __i1, iterator __i2, _ForwardIterator __k1, - _ForwardIterator __k2); + _M_replace_safe(iterator __i1, iterator __i2, _ForwardIterator __k1, + _ForwardIterator __k2); // _S_construct_aux is used to implement the 21.3.1 para 15 which // requires special behaviour if _InIter is an integral type 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 Tue Mar 12 23:10:33 2002 +++ libstdc++-v3/include/bits/basic_string.tcc Mon Mar 25 00:33:58 2002 @@ -498,13 +498,6 @@ // else nothing (in particular, avoid calling _M_mutate() unnecessarily.) } - // This is the general replace helper, which gets instantiated both - // for input-iterators and forward-iterators. It buffers internally and - // then calls _M_replace_safe. For input-iterators this is almost the - // best we can do, but for forward-iterators many optimizations could be - // conceived: f.i., when source and destination ranges do not overlap - // buffering is not really needed. In order to easily implement them, it - // could become useful to add an _M_replace(forward_iterator_tag) template template basic_string<_CharT, _Traits, _Alloc>& @@ -518,10 +511,8 @@ } // This is a special replace helper, which does not buffer internally - // and can be used in the "safe" situations involving forward-iterators, + // and can be used in "safe" situations involving forward-iterators, // i.e., when source and destination ranges are known to not overlap. - // Presently, is called by _M_replace, by the various append and by - // the assigns. template template basic_string<_CharT, _Traits, _Alloc>&