summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/bits/stl_algobase.h
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-07 11:14:11 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-07 11:14:11 +0000
commitfa9ecc47e472ab762b512cb10724490df63977e1 (patch)
treedb0f68e1e2e8c70e090187aac47f22a57f657970 /libstdc++-v3/include/bits/stl_algobase.h
parent8e9253759f3473ba68d0887bc008e276f6441593 (diff)
downloadppe42-gcc-fa9ecc47e472ab762b512cb10724490df63977e1.tar.gz
ppe42-gcc-fa9ecc47e472ab762b512cb10724490df63977e1.zip
2007-10-07 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algobase.h (_GLIBCXX_MOVE): Add. (swap, __iter_swap): Use it. * testsuite/25_algorithms/rotate/moveable.cc: Remove dg-require-rvalref. * testsuite/25_algorithms/remove/moveable.cc: Likewise. * testsuite/25_algorithms/partition/moveable.cc: Likewise. * testsuite/25_algorithms/swap_ranges/moveable.cc: Likewise. * testsuite/25_algorithms/reverse/moveable.cc: Likewise. * testsuite/25_algorithms/unique/moveable.cc: Likewise. * testsuite/25_algorithms/remove_if/moveable.cc: Likewise. * include/bits/stl_algobase.h (lexicographical_compare): Clean up. 2007-10-07 Chris Jefferson <chris@bubblescope.net> Paolo Carlini <pcarlini@suse.de> * include/bits/stl_algo.h (remove, remove_if, unique, __rotate(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, random_access_iterator_tag)): Use _GLIBCXX_MOVE. (__rotate(_ForwardIterator, _ForwardIterator, _ForwardIterator, forward_iterator_tag), __rotate(_BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, bidirectional_iterator_tag), __partition(_ForwardIterator, _ForwardIterator, _Predicate, forward_iterator_tag)): Use iter_swap. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129068 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/stl_algobase.h')
-rw-r--r--libstdc++-v3/include/bits/stl_algobase.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index c6648b43b9d..e0e285088d6 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -74,6 +74,13 @@
#include <bits/concept_check.h>
#include <debug/debug.h>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <utility>
+# define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
+#else
+# define _GLIBCXX_MOVE(_Tp) _Tp
+#endif
+
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
@@ -92,9 +99,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// concept requirements
__glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
- _Tp __tmp = __a;
- __a = __b;
- __b = __tmp;
+ _Tp __tmp = _GLIBCXX_MOVE(__a);
+ __a = _GLIBCXX_MOVE(__b);
+ __b = _GLIBCXX_MOVE(__tmp);
}
// See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a
@@ -109,9 +116,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
typedef typename iterator_traits<_ForwardIterator1>::value_type
_ValueType1;
- _ValueType1 __tmp = *__a;
- *__a = *__b;
- *__b = __tmp;
+ _ValueType1 __tmp = _GLIBCXX_MOVE(*__a);
+ *__a = _GLIBCXX_MOVE(*__b);
+ *__b = _GLIBCXX_MOVE(__tmp);
}
};
@@ -879,6 +886,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
{
typedef typename iterator_traits<_II1>::iterator_category _Category1;
typedef typename iterator_traits<_II2>::iterator_category _Category2;
+ typedef __lc_rai<_Category1, _Category2> __rai_type;
// concept requirements
typedef typename iterator_traits<_II1>::value_type _ValueType1;
@@ -890,12 +898,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
- __last1 = __lc_rai<_Category1, _Category2>::__newlast1(__first1,
- __last1,
- __first2,
- __last2);
- for (; __first1 != __last1
- && __lc_rai<_Category1, _Category2>::__cnd2(__first2, __last2);
+ __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
+ for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
++__first1, ++__first2)
{
if (*__first1 < *__first2)
OpenPOWER on IntegriCloud