This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Implement resolution of DR 300 [WP]
- From: Paolo Carlini <pcarlini at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 08 Nov 2003 22:20:22 +0100
- Subject: [v3] Implement resolution of DR 300 [WP]
Hi,
straightforward, tested x86-linux. I took the occasion to import R27
(diff not attached!)
Paolo.
//////////
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.
diff -urN libstdc++-v3-orig/docs/html/ext/howto.html libstdc++-v3/docs/html/ext/howto.html
--- libstdc++-v3-orig/docs/html/ext/howto.html 2003-10-22 17:44:19.000000000 +0200
+++ libstdc++-v3/docs/html/ext/howto.html 2003-11-08 22:04:10.000000000 +0100
@@ -593,7 +593,7 @@
for const instances.
</dd>
- <dt><a href="lwg-active.html#231">231</a>:
+ <dt><a href="lwg-defects.html#231">231</a>:
<em>Precision in iostream?</em>
</dt>
<dd>For conversion from a floating-point type, <code>str.precision()</code>
@@ -646,6 +646,11 @@
<dd>If <code>(this == &rhs)</code> do nothing.
</dd>
+ <dt><a href="lwg-defects.html#300">300</a>:
+ <em>List::merge() specification incomplete</em>
+ </dt>
+ <dd>If <code>(this == &x)</code> do nothing.
+ </dd>
<!--
<dt><a href="lwg-defects.html#"></a>:
<em></em>
diff -urN libstdc++-v3-orig/include/bits/list.tcc libstdc++-v3/include/bits/list.tcc
--- libstdc++-v3-orig/include/bits/list.tcc 2003-07-06 02:58:52.000000000 +0200
+++ libstdc++-v3/include/bits/list.tcc 2003-11-08 21:41:50.000000000 +0100
@@ -249,21 +249,26 @@
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 @@
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>