From 6d42ff7a1aa19bed95f190b98e5be3de147b37ce Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 27 Jan 2004 14:21:59 +0000 Subject: [PATCH] re PR libstdc++/12967 (Resolution of DR 300 [WP] still unimplemented) 2004-01-27 Paolo Carlini PR libstdc++/12967 * include/bits/list.tcc (merge): Implement resolution of DR 300 [WP]. From-SVN: r76705 --- libstdc++-v3/ChangeLog | 6 +++ libstdc++-v3/include/bits/list.tcc | 68 +++++++++++++++++------------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f30723246e02..dd156059bc74 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2004-01-27 Paolo Carlini + + PR libstdc++/12967 + * include/bits/list.tcc (merge): Implement resolution of + DR 300 [WP]. + 2004-01-27 Paolo Carlini PR libstdc++/13884 diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc index 898a5020c23b..16959d189f06 100644 --- a/libstdc++-v3/include/bits/list.tcc +++ b/libstdc++-v3/include/bits/list.tcc @@ -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 -- 2.47.2