summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/bits/list.tcc
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-08 21:17:30 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-08 21:17:30 +0000
commit2ee8eb6da7bae06c000df1fea44b2007d0fccff7 (patch)
tree9ed88946b233f49efbf9c3a7ed919fb516ff9791 /libstdc++-v3/include/bits/list.tcc
parent639e419174e2b963305e0c7ef8aa1bc647b76883 (diff)
downloadppe42-gcc-2ee8eb6da7bae06c000df1fea44b2007d0fccff7.tar.gz
ppe42-gcc-2ee8eb6da7bae06c000df1fea44b2007d0fccff7.zip
2003-11-08 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/12967 * include/bits/list.tcc (merge): Implement resolution of DR 300 [WP]. * docs/html/ext/howto.html: Add entry for DR 300; tweak entry for DR 231. * docs/html/ext/lwg-active.html, docs/html/ext/lwg-defects.html: Import R27. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73377 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/list.tcc')
-rw-r--r--libstdc++-v3/include/bits/list.tcc69
1 files changed, 40 insertions, 29 deletions
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index 2afde96995a..9c5a0cde607 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -249,21 +249,26 @@ namespace std
list<_Tp,_Alloc>::
merge(list& __x)
{
- iterator __first1 = begin();
- iterator __last1 = end();
- iterator __first2 = __x.begin();
- iterator __last2 = __x.end();
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first2 < *__first1)
- {
- iterator __next = __first2;
- _M_transfer(__first1, __first2, ++__next);
- __first2 = __next;
- }
- else
- ++__first1;
- if (__first2 != __last2)
- _M_transfer(__last1, __first2, __last2);
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 300. list::merge() specification incomplete
+ if (this != &__x)
+ {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ iterator __first2 = __x.begin();
+ iterator __last2 = __x.end();
+ while (__first1 != __last1 && __first2 != __last2)
+ if (*__first2 < *__first1)
+ {
+ iterator __next = __first2;
+ _M_transfer(__first1, __first2, ++__next);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ if (__first2 != __last2)
+ _M_transfer(__last1, __first2, __last2);
+ }
}
// FIXME put this somewhere else
@@ -351,20 +356,26 @@ namespace std
list<_Tp,_Alloc>::
merge(list& __x, _StrictWeakOrdering __comp)
{
- iterator __first1 = begin();
- iterator __last1 = end();
- iterator __first2 = __x.begin();
- iterator __last2 = __x.end();
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first2, *__first1))
- {
- iterator __next = __first2;
- _M_transfer(__first1, __first2, ++__next);
- __first2 = __next;
- }
- else
- ++__first1;
- if (__first2 != __last2) _M_transfer(__last1, __first2, __last2);
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 300. list::merge() specification incomplete
+ if (this != &__x)
+ {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ iterator __first2 = __x.begin();
+ iterator __last2 = __x.end();
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first2, *__first1))
+ {
+ iterator __next = __first2;
+ _M_transfer(__first1, __first2, ++__next);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ if (__first2 != __last2)
+ _M_transfer(__last1, __first2, __last2);
+ }
}
template<typename _Tp, typename _Alloc>
OpenPOWER on IntegriCloud