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
This commit is contained in:
parent
1c0f3facc4
commit
9c96a6896b
@ -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.
|
||||
|
@ -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&
|
||||
|
@ -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);
|
||||
|
||||
@ -750,17 +748,6 @@ namespace std
|
||||
return _M_replace_safe(_M_iend(), _M_iend(), __s, __s + __n);
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -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&
|
||||
|
Loading…
Reference in New Issue
Block a user