]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/12967 (Resolution of DR 300 [WP] still unimplemented)
authorPaolo Carlini <pcarlini@suse.de>
Tue, 27 Jan 2004 14:21:59 +0000 (14:21 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 27 Jan 2004 14:21:59 +0000 (14:21 +0000)
2004-01-27  Paolo Carlini  <pcarlini@suse.de>

PR libstdc++/12967
* include/bits/list.tcc (merge): Implement resolution of
DR 300 [WP].

From-SVN: r76705

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/list.tcc

index f30723246e02bef9c7c330d0f60f1cd5d222a3ff..dd156059bc746e2815de2866f1090b503ec1caa6 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-27  Paolo Carlini  <pcarlini@suse.de>
+
+       PR libstdc++/12967
+       * include/bits/list.tcc (merge): Implement resolution of
+       DR 300 [WP].
+
 2004-01-27  Paolo Carlini  <pcarlini@suse.de>
 
        PR libstdc++/13884
index 898a5020c23bbf03a10f0aa0a04954b9d6ddd6a9..16959d189f0622f79136b1b4d403352602548b0a 100644 (file)
@@ -216,21 +216,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
@@ -317,20 +322,25 @@ 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>