+2018-08-08 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/stl_algo.h
+ (__rotate(_Ite, _Ite, _Ite, forward_iterator_tag))
+ (__rotate(_Ite, _Ite, _Ite, bidirectional_iterator_tag))
+ (__rotate(_Ite, _Ite, _Ite, random_access_iterator_tag)): Move code duplication...
+ (rotate(_Ite, _Ite, _Ite)): ...here.
+ (__stable_partition_adaptive(_FIt, _FIt, _Pred, _Dist, _Pointer, _Dist)):
+ Simplify rotate call.
+ (__rotate_adaptive(_BIt1, _BIt1, _BIt1, _Dist, _Dist, _Bit2, _Dist)):
+ Likewise.
+ (__merge_without_buffer(_BIt, _BIt, _BIt, _Dist, _Dist, _Comp)):
+ Likewise.
+
2018-08-08 Jonathan Wakely <jwakely@redhat.com>
* libsupc++/new_opa.cc (aligned_alloc): Declare inside namespace to
_ForwardIterator __last,
forward_iterator_tag)
{
- if (__first == __middle)
- return __last;
- else if (__last == __middle)
- return __first;
-
_ForwardIterator __first2 = __middle;
do
{
__glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<
_BidirectionalIterator>)
- if (__first == __middle)
- return __last;
- else if (__last == __middle)
- return __first;
-
std::__reverse(__first, __middle, bidirectional_iterator_tag());
std::__reverse(__middle, __last, bidirectional_iterator_tag());
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
- if (__first == __middle)
- return __last;
- else if (__last == __middle)
- return __first;
-
typedef typename iterator_traits<_RandomAccessIterator>::difference_type
_Distance;
typedef typename iterator_traits<_RandomAccessIterator>::value_type
__glibcxx_requires_valid_range(__first, __middle);
__glibcxx_requires_valid_range(__middle, __last);
+ if (__first == __middle)
+ return __last;
+ else if (__last == __middle)
+ return __first;
+
return std::__rotate(__first, __middle, __last,
std::__iterator_category(__first));
}
__right_len,
__buffer, __buffer_size);
- std::rotate(__left_split, __middle, __right_split);
- std::advance(__left_split, std::distance(__middle, __right_split));
- return __left_split;
+ return std::rotate(__left_split, __middle, __right_split);
}
template<typename _ForwardIterator, typename _Predicate>
return __last;
}
else
- {
- std::rotate(__first, __middle, __last);
- std::advance(__first, std::distance(__middle, __last));
- return __first;
- }
+ return std::rotate(__first, __middle, __last);
}
/// This is a helper function for the merge routines.
__len11 = std::distance(__first, __first_cut);
}
- std::rotate(__first_cut, __middle, __second_cut);
- _BidirectionalIterator __new_middle = __first_cut;
- std::advance(__new_middle, std::distance(__middle, __second_cut));
+ _BidirectionalIterator __new_middle
+ = std::rotate(__first_cut, __middle, __second_cut);
std::__merge_without_buffer(__first, __first_cut, __new_middle,
__len11, __len22, __comp);
std::__merge_without_buffer(__new_middle, __second_cut, __last,