From 5cab70136913d6b6ab56de94620f0d62497c0460 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 15 Oct 2009 01:16:53 +0000 Subject: [PATCH] basic_string.h (operator+=(initializer_list<>), [...]): Forward to the append overload taking a const CharT* pointer and a size... 2009-10-14 Paolo Carlini * include/bits/basic_string.h (operator+=(initializer_list<>), append(initializer_list<>)): Forward to the append overload taking a const CharT* pointer and a size, thus avoiding instantiating unnecessarily in the built library the overload taking a pair of iterators. (operator=(initializer_list<>), assign(initializer_list<>)): Likewise for assign. (insert(iterator, initializer_list<>): Likewise for insert. From-SVN: r152794 --- libstdc++-v3/ChangeLog | 11 +++++++++++ libstdc++-v3/include/bits/basic_string.h | 13 ++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c995c7dbd302..31bbb59b5f38 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2009-10-14 Paolo Carlini + + * include/bits/basic_string.h (operator+=(initializer_list<>), + append(initializer_list<>)): Forward to the append overload taking + a const CharT* pointer and a size, thus avoiding instantiating + unnecessarily in the built library the overload taking a pair of + iterators. + (operator=(initializer_list<>), assign(initializer_list<>)): Likewise + for assign. + (insert(iterator, initializer_list<>): Likewise for insert. + 2009-10-14 Paolo Carlini * include/bits/c++config: Do not disable extern templates for string diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index bd54537cdc10..9d44dc4fdfc9 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -540,7 +540,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) basic_string& operator=(initializer_list<_CharT> __l) { - this->assign (__l.begin(), __l.end()); + this->assign(__l.begin(), __l.size()); return *this; } #endif // __GXX_EXPERIMENTAL_CXX0X__ @@ -860,7 +860,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) */ basic_string& operator+=(initializer_list<_CharT> __l) - { return this->append(__l.begin(), __l.end()); } + { return this->append(__l.begin(), __l.size()); } #endif // __GXX_EXPERIMENTAL_CXX0X__ /** @@ -926,7 +926,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) */ basic_string& append(initializer_list<_CharT> __l) - { return this->append(__l.begin(), __l.end()); } + { return this->append(__l.begin(), __l.size()); } #endif // __GXX_EXPERIMENTAL_CXX0X__ /** @@ -1045,7 +1045,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) */ basic_string& assign(initializer_list<_CharT> __l) - { return this->assign(__l.begin(), __l.end()); } + { return this->assign(__l.begin(), __l.size()); } #endif // __GXX_EXPERIMENTAL_CXX0X__ /** @@ -1089,7 +1089,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) */ void insert(iterator __p, initializer_list<_CharT> __l) - { this->insert(__p, __l.begin(), __l.end()); } + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); + this->insert(__p - _M_ibegin(), __l.begin(), __l.size()); + } #endif // __GXX_EXPERIMENTAL_CXX0X__ /**