diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-05 14:11:11 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-05 14:11:11 +0000 |
commit | 5910a795834d1f9858c9dade13c0d13e269a1727 (patch) | |
tree | 30641a73165472d83cdeb2b7fd1a56af00148c8d /libstdc++-v3/include/bits/stl_algo.h | |
parent | fd193bcd4b2ed21bbc003bb85c23db5e0d31e572 (diff) | |
download | ppe42-gcc-5910a795834d1f9858c9dade13c0d13e269a1727.tar.gz ppe42-gcc-5910a795834d1f9858c9dade13c0d13e269a1727.zip |
2009-10-05 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/lib/libstdc++.exp (check_v3_target_rvalref): Remove.
* testsuite/lib/dg-options.exp (dg-require-rvalref): Likewise.
2009-10-05 Chris Jefferson <chris@bubblescope.net>
* include/bits/stl_algo.h (__stable_partition_adaptive,
__rotate_adaptive, __merge_adaptive, __merge_sort_loop):
Extend to work with rvalue references in C++0x mode.
* testsuite/25_algorithms/inplace_merge/moveable2.cc: New.
* testsuite/25_algorithms/inplace_merge/moveable.cc: Likewise.
* testsuite/25_algorithms/stable_partition/moveable.cc: Likewise.
* testsuite/25_algorithms/stable_sort/moveable2.cc: Likewise.
* testsuite/25_algorithms/stable_sort/moveable.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152451 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/stl_algo.h')
-rw-r--r-- | libstdc++-v3/include/bits/stl_algo.h | 87 |
1 files changed, 56 insertions, 31 deletions
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index a745295e9b0..70cde1a4bf0 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -1862,15 +1862,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std) for (; __first != __last; ++__first) if (__pred(*__first)) { - *__result1 = *__first; + *__result1 = _GLIBCXX_MOVE(*__first); ++__result1; } else { - *__result2 = *__first; + *__result2 = _GLIBCXX_MOVE(*__first); ++__result2; } - std::copy(__buffer, __result2, __result1); + _GLIBCXX_MOVE3(__buffer, __result2, __result1); return __result1; } else @@ -2926,15 +2926,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _BidirectionalIterator2 __buffer_end; if (__len1 > __len2 && __len2 <= __buffer_size) { - __buffer_end = std::copy(__middle, __last, __buffer); - std::copy_backward(__first, __middle, __last); - return std::copy(__buffer, __buffer_end, __first); + __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); + _GLIBCXX_MOVE_BACKWARD3(__first, __middle, __last); + return _GLIBCXX_MOVE3(__buffer, __buffer_end, __first); } else if (__len1 <= __buffer_size) { - __buffer_end = std::copy(__first, __middle, __buffer); - std::copy(__middle, __last, __first); - return std::copy_backward(__buffer, __buffer_end, __last); + __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); + _GLIBCXX_MOVE3(__middle, __last, __first); + return _GLIBCXX_MOVE_BACKWARD3(__buffer, __buffer_end, __last); } else { @@ -2956,15 +2956,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { if (__len1 <= __len2 && __len1 <= __buffer_size) { - _Pointer __buffer_end = std::copy(__first, __middle, __buffer); - _GLIBCXX_STD_P::merge(__buffer, __buffer_end, __middle, __last, + _Pointer __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); + _GLIBCXX_STD_P::merge(_GLIBCXX_MAKE_MOVE_ITERATOR(__buffer), + _GLIBCXX_MAKE_MOVE_ITERATOR(__buffer_end), + _GLIBCXX_MAKE_MOVE_ITERATOR(__middle), + _GLIBCXX_MAKE_MOVE_ITERATOR(__last), __first); } else if (__len2 <= __buffer_size) { - _Pointer __buffer_end = std::copy(__middle, __last, __buffer); - std::__merge_backward(__first, __middle, __buffer, - __buffer_end, __last); + _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); + std::__merge_backward(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__middle), + _GLIBCXX_MAKE_MOVE_ITERATOR(__buffer), + _GLIBCXX_MAKE_MOVE_ITERATOR(__buffer_end), + __last); } else { @@ -3013,15 +3019,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { if (__len1 <= __len2 && __len1 <= __buffer_size) { - _Pointer __buffer_end = std::copy(__first, __middle, __buffer); - _GLIBCXX_STD_P::merge(__buffer, __buffer_end, __middle, __last, + _Pointer __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); + _GLIBCXX_STD_P::merge(_GLIBCXX_MAKE_MOVE_ITERATOR(__buffer), + _GLIBCXX_MAKE_MOVE_ITERATOR(__buffer_end), + _GLIBCXX_MAKE_MOVE_ITERATOR(__middle), + _GLIBCXX_MAKE_MOVE_ITERATOR(__last), __first, __comp); } else if (__len2 <= __buffer_size) { - _Pointer __buffer_end = std::copy(__middle, __last, __buffer); - std::__merge_backward(__first, __middle, __buffer, __buffer_end, - __last, __comp); + _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); + std::__merge_backward(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__middle), + _GLIBCXX_MAKE_MOVE_ITERATOR(__buffer), + _GLIBCXX_MAKE_MOVE_ITERATOR(__buffer_end), + __last,__comp); } else { @@ -3270,16 +3282,22 @@ _GLIBCXX_BEGIN_NAMESPACE(std) while (__last - __first >= __two_step) { - __result = _GLIBCXX_STD_P::merge(__first, __first + __step_size, - __first + __step_size, - __first + __two_step, - __result); + __result = _GLIBCXX_STD_P::merge( + _GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + __step_size), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + __step_size), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + __two_step), + __result); __first += __two_step; } __step_size = std::min(_Distance(__last - __first), __step_size); - _GLIBCXX_STD_P::merge(__first, __first + __step_size, - __first + __step_size, __last, + _GLIBCXX_STD_P::merge(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + + __step_size), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + + __step_size), + _GLIBCXX_MAKE_MOVE_ITERATOR(__last), __result); } @@ -3295,16 +3313,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) while (__last - __first >= __two_step) { - __result = _GLIBCXX_STD_P::merge(__first, __first + __step_size, - __first + __step_size, __first + __two_step, - __result, - __comp); + __result = _GLIBCXX_STD_P::merge( + _GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + __step_size), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + __step_size), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + __two_step), + __result, __comp); __first += __two_step; } __step_size = std::min(_Distance(__last - __first), __step_size); - _GLIBCXX_STD_P::merge(__first, __first + __step_size, - __first + __step_size, __last, __result, __comp); + _GLIBCXX_STD_P::merge(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + + __step_size), + _GLIBCXX_MAKE_MOVE_ITERATOR(__first + + __step_size), + _GLIBCXX_MAKE_MOVE_ITERATOR(__last), + __result, __comp); } template<typename _RandomAccessIterator, typename _Distance> |