56 #ifndef _STL_ALGOBASE_H
57 #define _STL_ALGOBASE_H 1
72 namespace std _GLIBCXX_VISIBILITY(default)
74 _GLIBCXX_BEGIN_NAMESPACE_VERSION
76 #if __cplusplus < 201103L
80 template<
bool _BoolType>
83 template<
typename _ForwardIterator1,
typename _ForwardIterator2>
85 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
87 typedef typename iterator_traits<_ForwardIterator1>::value_type
89 _ValueType1 __tmp = _GLIBCXX_MOVE(*__a);
90 *__a = _GLIBCXX_MOVE(*__b);
91 *__b = _GLIBCXX_MOVE(__tmp);
96 struct __iter_swap<true>
98 template<
typename _ForwardIterator1,
typename _ForwardIterator2>
100 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
117 template<
typename _ForwardIterator1,
typename _ForwardIterator2>
119 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
122 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
124 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
127 #if __cplusplus < 201103L
128 typedef typename iterator_traits<_ForwardIterator1>::value_type
130 typedef typename iterator_traits<_ForwardIterator2>::value_type
133 __glibcxx_function_requires(_ConvertibleConcept<_ValueType1,
135 __glibcxx_function_requires(_ConvertibleConcept<_ValueType2,
138 typedef typename iterator_traits<_ForwardIterator1>::reference
140 typedef typename iterator_traits<_ForwardIterator2>::reference
142 std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value
143 && __are_same<_ValueType1&, _ReferenceType1>::__value
144 && __are_same<_ValueType2&, _ReferenceType2>::__value>::
163 template<
typename _ForwardIterator1,
typename _ForwardIterator2>
165 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
166 _ForwardIterator2 __first2)
169 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
171 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
173 __glibcxx_requires_valid_range(__first1, __last1);
175 for (; __first1 != __last1; ++__first1, ++__first2)
191 template<
typename _Tp>
193 min(
const _Tp& __a,
const _Tp& __b)
196 __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
214 template<
typename _Tp>
216 max(
const _Tp& __a,
const _Tp& __b)
219 __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
237 template<
typename _Tp,
typename _Compare>
239 min(
const _Tp& __a,
const _Tp& __b, _Compare __comp)
242 if (__comp(__b, __a))
258 template<
typename _Tp,
typename _Compare>
260 max(
const _Tp& __a,
const _Tp& __b, _Compare __comp)
263 if (__comp(__a, __b))
270 template<
typename _Iterator>
272 : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value>
275 template<
typename _Iterator>
276 inline typename _Niter_base<_Iterator>::iterator_type
277 __niter_base(_Iterator __it)
278 {
return std::_Niter_base<_Iterator>::_S_base(__it); }
281 template<
typename _Iterator>
283 : _Iter_base<_Iterator, __is_move_iterator<_Iterator>::__value>
286 template<
typename _Iterator>
287 inline typename _Miter_base<_Iterator>::iterator_type
288 __miter_base(_Iterator __it)
289 {
return std::_Miter_base<_Iterator>::_S_base(__it); }
297 template<
bool,
bool,
typename>
300 template<
typename _II,
typename _OI>
302 __copy_m(_II __first, _II __last, _OI __result)
304 for (; __first != __last; ++__result, ++__first)
305 *__result = *__first;
310 #if __cplusplus >= 201103L
311 template<
typename _Category>
312 struct __copy_move<true, false, _Category>
314 template<
typename _II,
typename _OI>
316 __copy_m(_II __first, _II __last, _OI __result)
318 for (; __first != __last; ++__result, ++__first)
326 struct __copy_move<false, false, random_access_iterator_tag>
328 template<
typename _II,
typename _OI>
330 __copy_m(_II __first, _II __last, _OI __result)
332 typedef typename iterator_traits<_II>::difference_type _Distance;
333 for(_Distance __n = __last - __first; __n > 0; --__n)
335 *__result = *__first;
343 #if __cplusplus >= 201103L
345 struct __copy_move<true, false, random_access_iterator_tag>
347 template<
typename _II,
typename _OI>
349 __copy_m(_II __first, _II __last, _OI __result)
351 typedef typename iterator_traits<_II>::difference_type _Distance;
352 for(_Distance __n = __last - __first; __n > 0; --__n)
363 template<
bool _IsMove>
364 struct __copy_move<_IsMove, true, random_access_iterator_tag>
366 template<
typename _Tp>
368 __copy_m(
const _Tp* __first,
const _Tp* __last, _Tp* __result)
370 const ptrdiff_t _Num = __last - __first;
372 __builtin_memmove(__result, __first,
sizeof(_Tp) * _Num);
373 return __result + _Num;
377 template<
bool _IsMove,
typename _II,
typename _OI>
379 __copy_move_a(_II __first, _II __last, _OI __result)
381 typedef typename iterator_traits<_II>::value_type _ValueTypeI;
382 typedef typename iterator_traits<_OI>::value_type _ValueTypeO;
383 typedef typename iterator_traits<_II>::iterator_category _Category;
384 const bool __simple = (__is_trivial(_ValueTypeI)
385 && __is_pointer<_II>::__value
386 && __is_pointer<_OI>::__value
387 && __are_same<_ValueTypeI, _ValueTypeO>::__value);
389 return std::__copy_move<_IsMove, __simple,
390 _Category>::__copy_m(__first, __last, __result);
395 template<
typename _CharT>
398 template<
typename _CharT,
typename _Traits>
401 template<
typename _CharT,
typename _Traits>
404 template<
bool _IsMove,
typename _CharT>
405 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
407 __copy_move_a2(_CharT*, _CharT*,
410 template<
bool _IsMove,
typename _CharT>
411 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
413 __copy_move_a2(
const _CharT*,
const _CharT*,
416 template<
bool _IsMove,
typename _CharT>
417 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
422 template<
bool _IsMove,
typename _II,
typename _OI>
424 __copy_move_a2(_II __first, _II __last, _OI __result)
426 return _OI(std::__copy_move_a<_IsMove>(std::__niter_base(__first),
427 std::__niter_base(__last),
428 std::__niter_base(__result)));
448 template<
typename _II,
typename _OI>
450 copy(_II __first, _II __last, _OI __result)
453 __glibcxx_function_requires(_InputIteratorConcept<_II>)
454 __glibcxx_function_requires(_OutputIteratorConcept<_OI,
455 typename iterator_traits<_II>::value_type>)
456 __glibcxx_requires_valid_range(__first, __last);
458 return (std::__copy_move_a2<__is_move_iterator<_II>::__value>
459 (std::__miter_base(__first), std::__miter_base(__last),
463 #if __cplusplus >= 201103L
481 template<
typename _II,
typename _OI>
483 move(_II __first, _II __last, _OI __result)
486 __glibcxx_function_requires(_InputIteratorConcept<_II>)
487 __glibcxx_function_requires(_OutputIteratorConcept<_OI,
488 typename iterator_traits<_II>::value_type>)
489 __glibcxx_requires_valid_range(__first, __last);
491 return std::__copy_move_a2<true>(std::__miter_base(__first),
492 std::__miter_base(__last), __result);
495 #define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::move(_Tp, _Up, _Vp)
497 #define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::copy(_Tp, _Up, _Vp)
500 template<
bool,
bool,
typename>
501 struct __copy_move_backward
503 template<
typename _BI1,
typename _BI2>
505 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
507 while (__first != __last)
508 *--__result = *--__last;
513 #if __cplusplus >= 201103L
514 template<
typename _Category>
515 struct __copy_move_backward<true, false, _Category>
517 template<
typename _BI1,
typename _BI2>
519 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
521 while (__first != __last)
529 struct __copy_move_backward<false, false, random_access_iterator_tag>
531 template<
typename _BI1,
typename _BI2>
533 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
535 typename iterator_traits<_BI1>::difference_type __n;
536 for (__n = __last - __first; __n > 0; --__n)
537 *--__result = *--__last;
542 #if __cplusplus >= 201103L
544 struct __copy_move_backward<true, false, random_access_iterator_tag>
546 template<
typename _BI1,
typename _BI2>
548 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
550 typename iterator_traits<_BI1>::difference_type __n;
551 for (__n = __last - __first; __n > 0; --__n)
558 template<
bool _IsMove>
559 struct __copy_move_backward<_IsMove, true, random_access_iterator_tag>
561 template<
typename _Tp>
563 __copy_move_b(
const _Tp* __first,
const _Tp* __last, _Tp* __result)
565 const ptrdiff_t _Num = __last - __first;
567 __builtin_memmove(__result - _Num, __first,
sizeof(_Tp) * _Num);
568 return __result - _Num;
572 template<
bool _IsMove,
typename _BI1,
typename _BI2>
574 __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result)
576 typedef typename iterator_traits<_BI1>::value_type _ValueType1;
577 typedef typename iterator_traits<_BI2>::value_type _ValueType2;
578 typedef typename iterator_traits<_BI1>::iterator_category _Category;
579 const bool __simple = (__is_trivial(_ValueType1)
580 && __is_pointer<_BI1>::__value
581 && __is_pointer<_BI2>::__value
582 && __are_same<_ValueType1, _ValueType2>::__value);
584 return std::__copy_move_backward<_IsMove, __simple,
585 _Category>::__copy_move_b(__first,
590 template<
bool _IsMove,
typename _BI1,
typename _BI2>
592 __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result)
594 return _BI2(std::__copy_move_backward_a<_IsMove>
595 (std::__niter_base(__first), std::__niter_base(__last),
596 std::__niter_base(__result)));
617 template<
typename _BI1,
typename _BI2>
619 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result)
622 __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
623 __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
624 __glibcxx_function_requires(_ConvertibleConcept<
625 typename iterator_traits<_BI1>::value_type,
626 typename iterator_traits<_BI2>::value_type>)
627 __glibcxx_requires_valid_range(__first, __last);
629 return (std::__copy_move_backward_a2<__is_move_iterator<_BI1>::__value>
630 (std::__miter_base(__first), std::__miter_base(__last),
634 #if __cplusplus >= 201103L
653 template<
typename _BI1,
typename _BI2>
658 __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
659 __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
660 __glibcxx_function_requires(_ConvertibleConcept<
661 typename iterator_traits<_BI1>::value_type,
662 typename iterator_traits<_BI2>::value_type>)
663 __glibcxx_requires_valid_range(__first, __last);
665 return std::__copy_move_backward_a2<true>(std::__miter_base(__first),
666 std::__miter_base(__last),
670 #define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::move_backward(_Tp, _Up, _Vp)
672 #define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::copy_backward(_Tp, _Up, _Vp)
675 template<
typename _ForwardIterator,
typename _Tp>
677 __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value,
void>::__type
678 __fill_a(_ForwardIterator __first, _ForwardIterator __last,
681 for (; __first != __last; ++__first)
685 template<
typename _ForwardIterator,
typename _Tp>
687 __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value,
void>::__type
688 __fill_a(_ForwardIterator __first, _ForwardIterator __last,
691 const _Tp __tmp = __value;
692 for (; __first != __last; ++__first)
697 template<
typename _Tp>
699 __gnu_cxx::__enable_if<__is_byte<_Tp>::__value,
void>::__type
700 __fill_a(_Tp* __first, _Tp* __last,
const _Tp& __c)
702 const _Tp __tmp = __c;
703 __builtin_memset(__first, static_cast<unsigned char>(__tmp),
719 template<
typename _ForwardIterator,
typename _Tp>
721 fill(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __value)
724 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
726 __glibcxx_requires_valid_range(__first, __last);
728 std::__fill_a(std::__niter_base(__first), std::__niter_base(__last),
732 template<
typename _OutputIterator,
typename _Size,
typename _Tp>
734 __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
735 __fill_n_a(_OutputIterator __first, _Size __n,
const _Tp& __value)
737 for (__decltype(__n + 0) __niter = __n;
738 __niter > 0; --__niter, ++__first)
743 template<
typename _OutputIterator,
typename _Size,
typename _Tp>
745 __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type
746 __fill_n_a(_OutputIterator __first, _Size __n,
const _Tp& __value)
748 const _Tp __tmp = __value;
749 for (__decltype(__n + 0) __niter = __n;
750 __niter > 0; --__niter, ++__first)
755 template<
typename _Size,
typename _Tp>
757 __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type
758 __fill_n_a(_Tp* __first, _Size __n,
const _Tp& __c)
760 std::__fill_a(__first, __first + __n, __c);
761 return __first + __n;
779 template<
typename _OI,
typename _Size,
typename _Tp>
781 fill_n(_OI __first, _Size __n,
const _Tp& __value)
784 __glibcxx_function_requires(_OutputIteratorConcept<_OI, _Tp>)
786 return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value));
789 template<
bool _BoolType>
792 template<
typename _II1,
typename _II2>
794 equal(_II1 __first1, _II1 __last1, _II2 __first2)
796 for (; __first1 != __last1; ++__first1, ++__first2)
797 if (!(*__first1 == *__first2))
806 template<
typename _Tp>
808 equal(
const _Tp* __first1,
const _Tp* __last1,
const _Tp* __first2)
810 return !__builtin_memcmp(__first1, __first2,
sizeof(_Tp)
811 * (__last1 - __first1));
815 template<
typename _II1,
typename _II2>
817 __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2)
819 typedef typename iterator_traits<_II1>::value_type _ValueType1;
820 typedef typename iterator_traits<_II2>::value_type _ValueType2;
821 const bool __simple = ((__is_integer<_ValueType1>::__value
822 || __is_pointer<_ValueType1>::__value)
823 && __is_pointer<_II1>::__value
824 && __is_pointer<_II2>::__value
825 && __are_same<_ValueType1, _ValueType2>::__value);
831 template<
typename,
typename>
834 template<
typename _II1,
typename _II2>
836 __newlast1(_II1, _II1 __last1, _II2, _II2)
839 template<
typename _II>
841 __cnd2(_II __first, _II __last)
842 {
return __first != __last; }
846 struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag>
848 template<
typename _RAI1,
typename _RAI2>
850 __newlast1(_RAI1 __first1, _RAI1 __last1,
851 _RAI2 __first2, _RAI2 __last2)
853 const typename iterator_traits<_RAI1>::difference_type
854 __diff1 = __last1 - __first1;
855 const typename iterator_traits<_RAI2>::difference_type
856 __diff2 = __last2 - __first2;
857 return __diff2 < __diff1 ? __first1 + __diff2 : __last1;
860 template<
typename _RAI>
866 template<
bool _BoolType>
867 struct __lexicographical_compare
869 template<
typename _II1,
typename _II2>
870 static bool __lc(_II1, _II1, _II2, _II2);
873 template<
bool _BoolType>
874 template<
typename _II1,
typename _II2>
876 __lexicographical_compare<_BoolType>::
877 __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
879 typedef typename iterator_traits<_II1>::iterator_category _Category1;
880 typedef typename iterator_traits<_II2>::iterator_category _Category2;
881 typedef std::__lc_rai<_Category1, _Category2> __rai_type;
883 __last1 = __rai_type::__newlast1(__first1, __last1,
885 for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
886 ++__first1, ++__first2)
888 if (*__first1 < *__first2)
890 if (*__first2 < *__first1)
893 return __first1 == __last1 && __first2 != __last2;
897 struct __lexicographical_compare<true>
899 template<
typename _Tp,
typename _Up>
901 __lc(
const _Tp* __first1,
const _Tp* __last1,
902 const _Up* __first2,
const _Up* __last2)
904 const size_t __len1 = __last1 - __first1;
905 const size_t __len2 = __last2 - __first2;
906 const int __result = __builtin_memcmp(__first1, __first2,
908 return __result != 0 ? __result < 0 : __len1 < __len2;
912 template<
typename _II1,
typename _II2>
914 __lexicographical_compare_aux(_II1 __first1, _II1 __last1,
915 _II2 __first2, _II2 __last2)
917 typedef typename iterator_traits<_II1>::value_type _ValueType1;
918 typedef typename iterator_traits<_II2>::value_type _ValueType2;
919 const bool __simple =
920 (__is_byte<_ValueType1>::__value && __is_byte<_ValueType2>::__value
921 && !__gnu_cxx::__numeric_traits<_ValueType1>::__is_signed
922 && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed
923 && __is_pointer<_II1>::__value
924 && __is_pointer<_II2>::__value);
926 return std::__lexicographical_compare<__simple>::__lc(__first1, __last1,
941 template<
typename _ForwardIterator,
typename _Tp>
943 lower_bound(_ForwardIterator __first, _ForwardIterator __last,
946 #ifdef _GLIBCXX_CONCEPT_CHECKS
947 typedef typename iterator_traits<_ForwardIterator>::value_type
950 typedef typename iterator_traits<_ForwardIterator>::difference_type
954 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
955 __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)
956 __glibcxx_requires_partitioned_lower(__first, __last, __val);
962 _DistanceType __half = __len >> 1;
963 _ForwardIterator __middle = __first;
965 if (*__middle < __val)
969 __len = __len - __half - 1;
979 inline _GLIBCXX_CONSTEXPR
int
981 {
return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
983 inline _GLIBCXX_CONSTEXPR
unsigned
985 {
return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
987 inline _GLIBCXX_CONSTEXPR
long
989 {
return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); }
991 inline _GLIBCXX_CONSTEXPR
unsigned long
992 __lg(
unsigned long __n)
993 {
return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); }
995 inline _GLIBCXX_CONSTEXPR
long long
997 {
return sizeof(
long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); }
999 inline _GLIBCXX_CONSTEXPR
unsigned long long
1000 __lg(
unsigned long long __n)
1001 {
return sizeof(
long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); }
1003 _GLIBCXX_END_NAMESPACE_VERSION
1005 _GLIBCXX_BEGIN_NAMESPACE_ALGO
1019 template<
typename _II1,
typename _II2>
1021 equal(_II1 __first1, _II1 __last1, _II2 __first2)
1024 __glibcxx_function_requires(_InputIteratorConcept<_II1>)
1025 __glibcxx_function_requires(_InputIteratorConcept<_II2>)
1026 __glibcxx_function_requires(_EqualOpConcept<
1027 typename iterator_traits<_II1>::value_type,
1028 typename iterator_traits<_II2>::value_type>)
1029 __glibcxx_requires_valid_range(__first1, __last1);
1031 return std::__equal_aux(std::__niter_base(__first1),
1032 std::__niter_base(__last1),
1033 std::__niter_base(__first2));
1051 template<
typename _IIter1,
typename _IIter2,
typename _BinaryPredicate>
1053 equal(_IIter1 __first1, _IIter1 __last1,
1054 _IIter2 __first2, _BinaryPredicate __binary_pred)
1057 __glibcxx_function_requires(_InputIteratorConcept<_IIter1>)
1058 __glibcxx_function_requires(_InputIteratorConcept<_IIter2>)
1059 __glibcxx_requires_valid_range(__first1, __last1);
1061 for (; __first1 != __last1; ++__first1, ++__first2)
1062 if (!
bool(__binary_pred(*__first1, *__first2)))
1082 template<
typename _II1,
typename _II2>
1084 lexicographical_compare(_II1 __first1, _II1 __last1,
1085 _II2 __first2, _II2 __last2)
1087 #ifdef _GLIBCXX_CONCEPT_CHECKS
1089 typedef typename iterator_traits<_II1>::value_type _ValueType1;
1090 typedef typename iterator_traits<_II2>::value_type _ValueType2;
1092 __glibcxx_function_requires(_InputIteratorConcept<_II1>)
1093 __glibcxx_function_requires(_InputIteratorConcept<_II2>)
1094 __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
1095 __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
1096 __glibcxx_requires_valid_range(__first1, __last1);
1097 __glibcxx_requires_valid_range(__first2, __last2);
1099 return std::__lexicographical_compare_aux(std::__niter_base(__first1),
1100 std::__niter_base(__last1),
1101 std::__niter_base(__first2),
1102 std::__niter_base(__last2));
1118 template<
typename _II1,
typename _II2,
typename _Compare>
1120 lexicographical_compare(_II1 __first1, _II1 __last1,
1121 _II2 __first2, _II2 __last2, _Compare __comp)
1123 typedef typename iterator_traits<_II1>::iterator_category _Category1;
1124 typedef typename iterator_traits<_II2>::iterator_category _Category2;
1125 typedef std::__lc_rai<_Category1, _Category2> __rai_type;
1128 __glibcxx_function_requires(_InputIteratorConcept<_II1>)
1129 __glibcxx_function_requires(_InputIteratorConcept<_II2>)
1130 __glibcxx_requires_valid_range(__first1, __last1);
1131 __glibcxx_requires_valid_range(__first2, __last2);
1133 __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
1134 for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
1135 ++__first1, ++__first2)
1137 if (__comp(*__first1, *__first2))
1139 if (__comp(*__first2, *__first1))
1142 return __first1 == __last1 && __first2 != __last2;
1158 template<
typename _InputIterator1,
typename _InputIterator2>
1159 pair<_InputIterator1, _InputIterator2>
1160 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1161 _InputIterator2 __first2)
1164 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
1165 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
1166 __glibcxx_function_requires(_EqualOpConcept<
1167 typename iterator_traits<_InputIterator1>::value_type,
1168 typename iterator_traits<_InputIterator2>::value_type>)
1169 __glibcxx_requires_valid_range(__first1, __last1);
1171 while (__first1 != __last1 && *__first1 == *__first2)
1195 template<
typename _InputIterator1,
typename _InputIterator2,
1196 typename _BinaryPredicate>
1197 pair<_InputIterator1, _InputIterator2>
1198 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1199 _InputIterator2 __first2, _BinaryPredicate __binary_pred)
1202 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
1203 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
1204 __glibcxx_requires_valid_range(__first1, __last1);
1206 while (__first1 != __last1 &&
bool(__binary_pred(*__first1, *__first2)))
1214 _GLIBCXX_END_NAMESPACE_ALGO
1220 #ifdef _GLIBCXX_PARALLEL
bool equal(_II1 __first1, _II1 __last1, _II2 __first2)
Tests a range for element-wise equality.
Basis for explicit traits specializations.
const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
Parallel STL function calls corresponding to the stl_algobase.h header. The functions defined here ma...
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
Provides input iterator semantics for streambufs.
Provides output iterator semantics for streambufs.
void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
ISO C++ entities toplevel namespace is std.
constexpr int __lg(int __n)
This is a helper function for the sort routines and for random.tcc.
_OI copy(_II __first, _II __last, _OI __result)
Copies the range [first,last) into result.
_BI2 move_backward(_BI1 __first, _BI1 __last, _BI2 __result)
Moves the range [first,last) into result.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
Struct holding two objects of arbitrary type.
void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
Swaps the contents of two iterators.
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.