aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-01-18 09:54:46 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2004-01-18 09:54:46 +0000
commit9c96a6896b7a6a3932a989fe840c816693b5df76 (patch)
tree94d894a6fc1fd9a1fe5ec6acb02d6e5a174b1e99
parent1c0f3facc462973ee773703cf554bdb9344f9cdc (diff)
downloadgcc-9c96a6896b7a6a3932a989fe840c816693b5df76.zip
gcc-9c96a6896b7a6a3932a989fe840c816693b5df76.tar.gz
gcc-9c96a6896b7a6a3932a989fe840c816693b5df76.tar.bz2
basic_string.h (append(size_type, _CharT)): Moved inline...
2004-01-18 Paolo Carlini <pcarlini@suse.de> * include/bits/basic_string.h (append(size_type, _CharT)): Moved inline, just call _M_replace_aux, no source iterators at risk of being clobbered. (assign(size_type, _CharT)): Call directly _M_replace_aux. (_M_replace(iterator, iterator, _InputIterator, _InputIterator, input_iterator_tag)): Remove fifth unused argument. (_M_replace_dispatch(iterator, iterator, _InputIterator, _InputIterator, __false_type)): Update call. * include/bits/basic_string.tcc (replace(size_type, size_type, const _CharT*, size_type)): Update call. (_M_replace_aux(iterator, iterator, size_type, _CharT)): Tweak throw string literal. (_M_replace_safe(iterator, iterator, _ForwardIterator, _ForwardIterator)): Likewise. (_M_replace(iterator, iterator, _InputIterator, _InputIterator, input_iterator_tag)): Remove fifth unused argument. (append(size_type __n, _CharT __c)): Move inline. * src/string-inst.cc (S::_M_replace(S::iterator, S::iterator, const C*, const C*, input_iterator_tag)): Remove fifth unused argument. From-SVN: r76091
-rw-r--r--libstdc++-v3/ChangeLog23
-rw-r--r--libstdc++-v3/include/bits/basic_string.h15
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc29
-rw-r--r--libstdc++-v3/src/string-inst.cc3
4 files changed, 38 insertions, 32 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index c4fb706..5590ce4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,26 @@
+2004-01-18 Paolo Carlini <pcarlini@suse.de>
+
+ * include/bits/basic_string.h (append(size_type, _CharT)):
+ Moved inline, just call _M_replace_aux, no source iterators at
+ risk of being clobbered.
+ (assign(size_type, _CharT)): Call directly _M_replace_aux.
+ (_M_replace(iterator, iterator, _InputIterator, _InputIterator,
+ input_iterator_tag)): Remove fifth unused argument.
+ (_M_replace_dispatch(iterator, iterator, _InputIterator,
+ _InputIterator, __false_type)): Update call.
+ * include/bits/basic_string.tcc (replace(size_type, size_type,
+ const _CharT*, size_type)): Update call.
+ (_M_replace_aux(iterator, iterator, size_type, _CharT)): Tweak
+ throw string literal.
+ (_M_replace_safe(iterator, iterator, _ForwardIterator,
+ _ForwardIterator)): Likewise.
+ (_M_replace(iterator, iterator, _InputIterator, _InputIterator,
+ input_iterator_tag)): Remove fifth unused argument.
+ (append(size_type __n, _CharT __c)): Move inline.
+ * src/string-inst.cc (S::_M_replace(S::iterator, S::iterator,
+ const C*, const C*, input_iterator_tag)): Remove fifth unused
+ argument.
+
2004-01-16 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/ext/enc_filebuf/char/13189.cc: Fix guards.
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 0b679e0..d9847a4 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -1,6 +1,6 @@
// Components for manipulating sequences of characters -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -751,7 +751,8 @@ namespace std
* Appends n copies of c to this string.
*/
basic_string&
- append(size_type __n, _CharT __c);
+ append(size_type __n, _CharT __c)
+ { return _M_replace_aux(_M_iend(), _M_iend(), __n, __c); }
/**
* @brief Append a range of characters.
@@ -837,7 +838,7 @@ namespace std
*/
basic_string&
assign(size_type __n, _CharT __c)
- { return this->replace(_M_ibegin(), _M_iend(), __n, __c); }
+ { return _M_replace_aux(_M_ibegin(), _M_iend(), __n, __c); }
/**
* @brief Set value to a range of characters.
@@ -1362,11 +1363,7 @@ namespace std
basic_string&
_M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
_InputIterator __k2, __false_type)
- {
- typedef typename iterator_traits<_InputIterator>::iterator_category
- _Category;
- return _M_replace(__i1, __i2, __k1, __k2, _Category());
- }
+ { return _M_replace(__i1, __i2, __k1, __k2); }
basic_string&
_M_replace_aux(iterator __i1, iterator __i2, size_type __n2, _CharT __c);
@@ -1374,7 +1371,7 @@ namespace std
template<class _InputIterator>
basic_string&
_M_replace(iterator __i1, iterator __i2, _InputIterator __k1,
- _InputIterator __k2, input_iterator_tag);
+ _InputIterator __k2);
template<class _ForwardIterator>
basic_string&
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 87eac7a..5f50d36 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1,6 +1,6 @@
// Components for manipulating sequences of characters -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -380,8 +380,7 @@ namespace std
// Todo: optimized in-place replace.
else
return _M_replace(_M_ibegin() + __pos, _M_ibegin() + __pos + __foldn1,
- __s, __s + __n2,
- typename iterator_traits<const _CharT*>::iterator_category());
+ __s, __s + __n2);
}
template<typename _CharT, typename _Traits, typename _Alloc>
@@ -642,23 +641,22 @@ namespace std
const size_type __n1 = __i2 - __i1;
const size_type __off1 = __i1 - _M_ibegin();
if (max_size() - (this->size() - __n1) <= __n2)
- __throw_length_error("basic_string::replace");
- _M_mutate (__off1, __n1, __n2);
+ __throw_length_error("basic_string::_M_replace_aux");
+ _M_mutate(__off1, __n1, __n2);
// Invalidated __i1, __i2
if (__n2)
traits_type::assign(_M_data() + __off1, __n2, __c);
return *this;
}
- // This is the general replace helper, which currently gets instantiated both
- // for input iterators and reverse iterators. It buffers internally and then
- // calls _M_replace_safe.
+ // This is the general replace helper. It buffers internally and then calls
+ // _M_replace_safe.
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InputIterator>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::
_M_replace(iterator __i1, iterator __i2, _InputIterator __k1,
- _InputIterator __k2, input_iterator_tag)
+ _InputIterator __k2)
{
// Save concerned source string data in a temporary.
const basic_string __s(__k1, __k2);
@@ -680,7 +678,7 @@ namespace std
const size_type __dmax = this->max_size();
if (__dmax <= __dnew)
- __throw_length_error("basic_string::_M_replace");
+ __throw_length_error("basic_string::_M_replace_safe");
const size_type __off = __i1 - _M_ibegin();
_M_mutate(__off, __dold, __dnew);
@@ -751,17 +749,6 @@ namespace std
}
template<typename _CharT, typename _Traits, typename _Alloc>
- basic_string<_CharT, _Traits, _Alloc>&
- basic_string<_CharT, _Traits, _Alloc>::
- append(size_type __n, _CharT __c)
- {
- const size_type __len = __n + this->size();
- if (__len > this->capacity())
- this->reserve(__len);
- return this->replace(_M_iend(), _M_iend(), __n, __c);
- }
-
- template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>
operator+(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Alloc>& __rhs)
diff --git a/libstdc++-v3/src/string-inst.cc b/libstdc++-v3/src/string-inst.cc
index ab779b8..d400d4f 100644
--- a/libstdc++-v3/src/string-inst.cc
+++ b/libstdc++-v3/src/string-inst.cc
@@ -65,8 +65,7 @@ namespace std
template
S&
- S::_M_replace(S::iterator, S::iterator, const C*, const C*,
- input_iterator_tag);
+ S::_M_replace(S::iterator, S::iterator, const C*, const C*);
template
S&