summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-25 22:43:07 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-25 22:43:07 +0000
commit9a08ff02a58b5c3330c058cf69e33072ed14d7b2 (patch)
tree0f881c663b9d73cd90e24d7a13603c5783da8a47 /libstdc++-v3
parentb40736280d5448b24f6e98bd60f81d950dce4722 (diff)
downloadgcc-9a08ff02a58b5c3330c058cf69e33072ed14d7b2.tar.gz
2004-01-25 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.h (_M_replace_aux, _M_replace_safe): Define inline here. * include/bits/basic_string.tcc (_M_replace_aux, _M_replace_safe): Move inline. * include/bits/basic_string.tcc: Very minor tweaks. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76592 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/include/bits/basic_string.h19
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc34
3 files changed, 29 insertions, 33 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f7a91a26af5..5a3ca4291ef 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,14 @@
2004-01-25 Paolo Carlini <pcarlini@suse.de>
+ * include/bits/basic_string.h (_M_replace_aux, _M_replace_safe):
+ Define inline here.
+ * include/bits/basic_string.tcc (_M_replace_aux, _M_replace_safe):
+ Move inline.
+
+ * include/bits/basic_string.tcc: Very minor tweaks.
+
+2004-01-25 Paolo Carlini <pcarlini@suse.de>
+
* testsuite/performance/string_append.cc: Increase number
of iterations.
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index a42a5c40361..19bb8000a0f 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -1361,11 +1361,26 @@ namespace std
_InputIterator __k2, __false_type);
basic_string&
- _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, _CharT __c);
+ _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
+ _CharT __c)
+ {
+ if (this->max_size() - (this->size() - __n1) < __n2)
+ __throw_length_error("basic_string::_M_replace_aux");
+ _M_mutate(__pos1, __n1, __n2);
+ if (__n2)
+ traits_type::assign(_M_data() + __pos1, __n2, __c);
+ return *this;
+ }
basic_string&
_M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,
- size_type __n2);
+ size_type __n2)
+ {
+ _M_mutate(__pos1, __n1, __n2);
+ if (__n2)
+ traits_type::copy(_M_data() + __pos1, __s, __n2);
+ return *this;
+ }
// _S_construct_aux is used to implement the 21.3.1 para 15 which
// requires special behaviour if _InIter is an integral type
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 143c2bae3df..3d9df9f5e48 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -142,7 +142,7 @@ namespace std
}
template<typename _CharT, typename _Traits, typename _Alloc>
- template <class _InIterator>
+ template <typename _InIterator>
_CharT*
basic_string<_CharT, _Traits, _Alloc>::
_S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
@@ -391,7 +391,7 @@ namespace std
|| _M_rep()->_M_is_shared() || __new_size > capacity())
{
// Must reallocate.
- allocator_type __a = get_allocator();
+ const allocator_type __a = get_allocator();
// See below (_S_create) for the meaning and value of these
// constants.
const size_type __pagesize = 4096;
@@ -439,7 +439,7 @@ namespace std
// Make sure we don't shrink below the current size
if (__res < this->size())
__res = this->size();
- allocator_type __a = get_allocator();
+ const allocator_type __a = get_allocator();
_CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size());
_M_rep()->_M_dispose(__a);
_M_data(__tmp);
@@ -599,34 +599,6 @@ namespace std
__s.size());
}
- // This helper doesn't buffer internally and can be used in "safe" situations,
- // i.e., when source and destination ranges are known to not overlap.
- template<typename _CharT, typename _Traits, typename _Alloc>
- basic_string<_CharT, _Traits, _Alloc>&
- basic_string<_CharT, _Traits, _Alloc>::
- _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,
- size_type __n2)
- {
- _M_mutate(__pos1, __n1, __n2);
- if (__n2)
- traits_type::copy(_M_data() + __pos1, __s, __n2);
- return *this;
- }
-
- template<typename _CharT, typename _Traits, typename _Alloc>
- basic_string<_CharT, _Traits, _Alloc>&
- basic_string<_CharT, _Traits, _Alloc>::
- _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
- _CharT __c)
- {
- if (this->max_size() - (this->size() - __n1) < __n2)
- __throw_length_error("basic_string::_M_replace_aux");
- _M_mutate(__pos1, __n1, __n2);
- if (__n2)
- traits_type::assign(_M_data() + __pos1, __n2, __c);
- return *this;
- }
-
template<typename _CharT, typename _Traits, typename _Alloc>
basic_string<_CharT, _Traits, _Alloc>&
basic_string<_CharT, _Traits, _Alloc>::