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>
|
2004-01-16 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* testsuite/ext/enc_filebuf/char/13189.cc: Fix guards.
|
* testsuite/ext/enc_filebuf/char/13189.cc: Fix guards.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Components for manipulating sequences of characters -*- C++ -*-
|
// 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.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// 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.
|
* Appends n copies of c to this string.
|
||||||
*/
|
*/
|
||||||
basic_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.
|
* @brief Append a range of characters.
|
||||||
@ -837,7 +838,7 @@ namespace std
|
|||||||
*/
|
*/
|
||||||
basic_string&
|
basic_string&
|
||||||
assign(size_type __n, _CharT __c)
|
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.
|
* @brief Set value to a range of characters.
|
||||||
@ -1362,11 +1363,7 @@ namespace std
|
|||||||
basic_string&
|
basic_string&
|
||||||
_M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
|
_M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
|
||||||
_InputIterator __k2, __false_type)
|
_InputIterator __k2, __false_type)
|
||||||
{
|
{ return _M_replace(__i1, __i2, __k1, __k2); }
|
||||||
typedef typename iterator_traits<_InputIterator>::iterator_category
|
|
||||||
_Category;
|
|
||||||
return _M_replace(__i1, __i2, __k1, __k2, _Category());
|
|
||||||
}
|
|
||||||
|
|
||||||
basic_string&
|
basic_string&
|
||||||
_M_replace_aux(iterator __i1, iterator __i2, size_type __n2, _CharT __c);
|
_M_replace_aux(iterator __i1, iterator __i2, size_type __n2, _CharT __c);
|
||||||
@ -1374,7 +1371,7 @@ namespace std
|
|||||||
template<class _InputIterator>
|
template<class _InputIterator>
|
||||||
basic_string&
|
basic_string&
|
||||||
_M_replace(iterator __i1, iterator __i2, _InputIterator __k1,
|
_M_replace(iterator __i1, iterator __i2, _InputIterator __k1,
|
||||||
_InputIterator __k2, input_iterator_tag);
|
_InputIterator __k2);
|
||||||
|
|
||||||
template<class _ForwardIterator>
|
template<class _ForwardIterator>
|
||||||
basic_string&
|
basic_string&
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Components for manipulating sequences of characters -*- C++ -*-
|
// 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.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// 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.
|
// Todo: optimized in-place replace.
|
||||||
else
|
else
|
||||||
return _M_replace(_M_ibegin() + __pos, _M_ibegin() + __pos + __foldn1,
|
return _M_replace(_M_ibegin() + __pos, _M_ibegin() + __pos + __foldn1,
|
||||||
__s, __s + __n2,
|
__s, __s + __n2);
|
||||||
typename iterator_traits<const _CharT*>::iterator_category());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||||
@ -642,23 +641,22 @@ namespace std
|
|||||||
const size_type __n1 = __i2 - __i1;
|
const size_type __n1 = __i2 - __i1;
|
||||||
const size_type __off1 = __i1 - _M_ibegin();
|
const size_type __off1 = __i1 - _M_ibegin();
|
||||||
if (max_size() - (this->size() - __n1) <= __n2)
|
if (max_size() - (this->size() - __n1) <= __n2)
|
||||||
__throw_length_error("basic_string::replace");
|
__throw_length_error("basic_string::_M_replace_aux");
|
||||||
_M_mutate (__off1, __n1, __n2);
|
_M_mutate(__off1, __n1, __n2);
|
||||||
// Invalidated __i1, __i2
|
// Invalidated __i1, __i2
|
||||||
if (__n2)
|
if (__n2)
|
||||||
traits_type::assign(_M_data() + __off1, __n2, __c);
|
traits_type::assign(_M_data() + __off1, __n2, __c);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the general replace helper, which currently gets instantiated both
|
// This is the general replace helper. It buffers internally and then calls
|
||||||
// for input iterators and reverse iterators. It buffers internally and then
|
// _M_replace_safe.
|
||||||
// calls _M_replace_safe.
|
|
||||||
template<typename _CharT, typename _Traits, typename _Alloc>
|
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||||
template<typename _InputIterator>
|
template<typename _InputIterator>
|
||||||
basic_string<_CharT, _Traits, _Alloc>&
|
basic_string<_CharT, _Traits, _Alloc>&
|
||||||
basic_string<_CharT, _Traits, _Alloc>::
|
basic_string<_CharT, _Traits, _Alloc>::
|
||||||
_M_replace(iterator __i1, iterator __i2, _InputIterator __k1,
|
_M_replace(iterator __i1, iterator __i2, _InputIterator __k1,
|
||||||
_InputIterator __k2, input_iterator_tag)
|
_InputIterator __k2)
|
||||||
{
|
{
|
||||||
// Save concerned source string data in a temporary.
|
// Save concerned source string data in a temporary.
|
||||||
const basic_string __s(__k1, __k2);
|
const basic_string __s(__k1, __k2);
|
||||||
@ -680,7 +678,7 @@ namespace std
|
|||||||
const size_type __dmax = this->max_size();
|
const size_type __dmax = this->max_size();
|
||||||
|
|
||||||
if (__dmax <= __dnew)
|
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();
|
const size_type __off = __i1 - _M_ibegin();
|
||||||
_M_mutate(__off, __dold, __dnew);
|
_M_mutate(__off, __dold, __dnew);
|
||||||
|
|
||||||
@ -750,17 +748,6 @@ namespace std
|
|||||||
return _M_replace_safe(_M_iend(), _M_iend(), __s, __s + __n);
|
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>
|
template<typename _CharT, typename _Traits, typename _Alloc>
|
||||||
basic_string<_CharT, _Traits, _Alloc>
|
basic_string<_CharT, _Traits, _Alloc>
|
||||||
operator+(const _CharT* __lhs,
|
operator+(const _CharT* __lhs,
|
||||||
|
@ -65,8 +65,7 @@ namespace std
|
|||||||
|
|
||||||
template
|
template
|
||||||
S&
|
S&
|
||||||
S::_M_replace(S::iterator, S::iterator, const C*, const C*,
|
S::_M_replace(S::iterator, S::iterator, const C*, const C*);
|
||||||
input_iterator_tag);
|
|
||||||
|
|
||||||
template
|
template
|
||||||
S&
|
S&
|
||||||
|
Loading…
Reference in New Issue
Block a user