57 #ifndef _STL_ALGOBASE_H
58 #define _STL_ALGOBASE_H 1
73 namespace std _GLIBCXX_VISIBILITY(default)
75 _GLIBCXX_BEGIN_NAMESPACE_VERSION
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)
116 template<
typename _ForwardIterator1,
typename _ForwardIterator2>
118 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
120 typedef typename iterator_traits<_ForwardIterator1>::value_type
122 typedef typename iterator_traits<_ForwardIterator2>::value_type
126 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
128 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
130 __glibcxx_function_requires(_ConvertibleConcept<_ValueType1,
132 __glibcxx_function_requires(_ConvertibleConcept<_ValueType2,
135 typedef typename iterator_traits<_ForwardIterator1>::reference
137 typedef typename iterator_traits<_ForwardIterator2>::reference
139 std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value
140 && __are_same<_ValueType1&, _ReferenceType1>::__value
141 && __are_same<_ValueType2&, _ReferenceType2>::__value>::
157 template<
typename _ForwardIterator1,
typename _ForwardIterator2>
159 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
160 _ForwardIterator2 __first2)
163 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
165 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
167 __glibcxx_requires_valid_range(__first1, __last1);
169 for (; __first1 != __last1; ++__first1, ++__first2)
185 template<
typename _Tp>
187 min(
const _Tp& __a,
const _Tp& __b)
190 __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
208 template<
typename _Tp>
210 max(
const _Tp& __a,
const _Tp& __b)
213 __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
231 template<
typename _Tp,
typename _Compare>
233 min(
const _Tp& __a,
const _Tp& __b, _Compare __comp)
236 if (__comp(__b, __a))
252 template<
typename _Tp,
typename _Compare>
254 max(
const _Tp& __a,
const _Tp& __b, _Compare __comp)
257 if (__comp(__a, __b))
264 template<
typename _Iterator>
266 : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value>
269 template<
typename _Iterator>
270 inline typename _Niter_base<_Iterator>::iterator_type
271 __niter_base(_Iterator __it)
272 {
return std::_Niter_base<_Iterator>::_S_base(__it); }
275 template<
typename _Iterator>
277 : _Iter_base<_Iterator, __is_move_iterator<_Iterator>::__value>
280 template<
typename _Iterator>
281 inline typename _Miter_base<_Iterator>::iterator_type
282 __miter_base(_Iterator __it)
283 {
return std::_Miter_base<_Iterator>::_S_base(__it); }
291 template<
bool,
bool,
typename>
294 template<
typename _II,
typename _OI>
296 __copy_m(_II __first, _II __last, _OI __result)
298 for (; __first != __last; ++__result, ++__first)
299 *__result = *__first;
304 #ifdef __GXX_EXPERIMENTAL_CXX0X__
305 template<
typename _Category>
306 struct __copy_move<true, false, _Category>
308 template<
typename _II,
typename _OI>
310 __copy_m(_II __first, _II __last, _OI __result)
312 for (; __first != __last; ++__result, ++__first)
313 *__result = std::move(*__first);
320 struct __copy_move<false, false, random_access_iterator_tag>
322 template<
typename _II,
typename _OI>
324 __copy_m(_II __first, _II __last, _OI __result)
326 typedef typename iterator_traits<_II>::difference_type _Distance;
327 for(_Distance __n = __last - __first; __n > 0; --__n)
329 *__result = *__first;
337 #ifdef __GXX_EXPERIMENTAL_CXX0X__
339 struct __copy_move<true, false, random_access_iterator_tag>
341 template<
typename _II,
typename _OI>
343 __copy_m(_II __first, _II __last, _OI __result)
345 typedef typename iterator_traits<_II>::difference_type _Distance;
346 for(_Distance __n = __last - __first; __n > 0; --__n)
348 *__result = std::move(*__first);
357 template<
bool _IsMove>
358 struct __copy_move<_IsMove, true, random_access_iterator_tag>
360 template<
typename _Tp>
362 __copy_m(
const _Tp* __first,
const _Tp* __last, _Tp* __result)
364 const ptrdiff_t _Num = __last - __first;
366 __builtin_memmove(__result, __first,
sizeof(_Tp) * _Num);
367 return __result + _Num;
371 template<
bool _IsMove,
typename _II,
typename _OI>
373 __copy_move_a(_II __first, _II __last, _OI __result)
375 typedef typename iterator_traits<_II>::value_type _ValueTypeI;
376 typedef typename iterator_traits<_OI>::value_type _ValueTypeO;
377 typedef typename iterator_traits<_II>::iterator_category _Category;
378 const bool __simple = (__is_trivial(_ValueTypeI)
379 && __is_pointer<_II>::__value
380 && __is_pointer<_OI>::__value
381 && __are_same<_ValueTypeI, _ValueTypeO>::__value);
383 return std::__copy_move<_IsMove, __simple,
384 _Category>::__copy_m(__first, __last, __result);
389 template<
typename _CharT>
392 template<
typename _CharT,
typename _Traits>
393 class istreambuf_iterator;
395 template<
typename _CharT,
typename _Traits>
396 class ostreambuf_iterator;
398 template<
bool _IsMove,
typename _CharT>
399 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
400 ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
401 __copy_move_a2(_CharT*, _CharT*,
402 ostreambuf_iterator<_CharT, char_traits<_CharT> >);
404 template<
bool _IsMove,
typename _CharT>
405 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
406 ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
407 __copy_move_a2(
const _CharT*,
const _CharT*,
408 ostreambuf_iterator<_CharT, char_traits<_CharT> >);
410 template<
bool _IsMove,
typename _CharT>
411 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
413 __copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >,
414 istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*);
416 template<
bool _IsMove,
typename _II,
typename _OI>
418 __copy_move_a2(_II __first, _II __last, _OI __result)
420 return _OI(std::__copy_move_a<_IsMove>(std::__niter_base(__first),
421 std::__niter_base(__last),
422 std::__niter_base(__result)));
442 template<
typename _II,
typename _OI>
444 copy(_II __first, _II __last, _OI __result)
447 __glibcxx_function_requires(_InputIteratorConcept<_II>)
448 __glibcxx_function_requires(_OutputIteratorConcept<_OI,
449 typename iterator_traits<_II>::value_type>)
450 __glibcxx_requires_valid_range(__first, __last);
452 return (std::__copy_move_a2<__is_move_iterator<_II>::__value>
453 (std::__miter_base(__first), std::__miter_base(__last),
457 #ifdef __GXX_EXPERIMENTAL_CXX0X__
475 template<
typename _II,
typename _OI>
477 move(_II __first, _II __last, _OI __result)
480 __glibcxx_function_requires(_InputIteratorConcept<_II>)
481 __glibcxx_function_requires(_OutputIteratorConcept<_OI,
482 typename iterator_traits<_II>::value_type>)
483 __glibcxx_requires_valid_range(__first, __last);
485 return std::__copy_move_a2<true>(std::__miter_base(__first),
486 std::__miter_base(__last), __result);
489 #define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::move(_Tp, _Up, _Vp)
491 #define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::copy(_Tp, _Up, _Vp)
494 template<
bool,
bool,
typename>
495 struct __copy_move_backward
497 template<
typename _BI1,
typename _BI2>
499 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
501 while (__first != __last)
502 *--__result = *--__last;
507 #ifdef __GXX_EXPERIMENTAL_CXX0X__
508 template<
typename _Category>
509 struct __copy_move_backward<true, false, _Category>
511 template<
typename _BI1,
typename _BI2>
513 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
515 while (__first != __last)
516 *--__result = std::move(*--__last);
523 struct __copy_move_backward<false, false, random_access_iterator_tag>
525 template<
typename _BI1,
typename _BI2>
527 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
529 typename iterator_traits<_BI1>::difference_type __n;
530 for (__n = __last - __first; __n > 0; --__n)
531 *--__result = *--__last;
536 #ifdef __GXX_EXPERIMENTAL_CXX0X__
538 struct __copy_move_backward<true, false, random_access_iterator_tag>
540 template<
typename _BI1,
typename _BI2>
542 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
544 typename iterator_traits<_BI1>::difference_type __n;
545 for (__n = __last - __first; __n > 0; --__n)
546 *--__result = std::move(*--__last);
552 template<
bool _IsMove>
553 struct __copy_move_backward<_IsMove, true, random_access_iterator_tag>
555 template<
typename _Tp>
557 __copy_move_b(
const _Tp* __first,
const _Tp* __last, _Tp* __result)
559 const ptrdiff_t _Num = __last - __first;
561 __builtin_memmove(__result - _Num, __first,
sizeof(_Tp) * _Num);
562 return __result - _Num;
566 template<
bool _IsMove,
typename _BI1,
typename _BI2>
568 __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result)
570 typedef typename iterator_traits<_BI1>::value_type _ValueType1;
571 typedef typename iterator_traits<_BI2>::value_type _ValueType2;
572 typedef typename iterator_traits<_BI1>::iterator_category _Category;
573 const bool __simple = (__is_trivial(_ValueType1)
574 && __is_pointer<_BI1>::__value
575 && __is_pointer<_BI2>::__value
576 && __are_same<_ValueType1, _ValueType2>::__value);
578 return std::__copy_move_backward<_IsMove, __simple,
579 _Category>::__copy_move_b(__first,
584 template<
bool _IsMove,
typename _BI1,
typename _BI2>
586 __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result)
588 return _BI2(std::__copy_move_backward_a<_IsMove>
589 (std::__niter_base(__first), std::__niter_base(__last),
590 std::__niter_base(__result)));
611 template<
typename _BI1,
typename _BI2>
613 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result)
616 __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
617 __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
618 __glibcxx_function_requires(_ConvertibleConcept<
619 typename iterator_traits<_BI1>::value_type,
620 typename iterator_traits<_BI2>::value_type>)
621 __glibcxx_requires_valid_range(__first, __last);
623 return (std::__copy_move_backward_a2<__is_move_iterator<_BI1>::__value>
624 (std::__miter_base(__first), std::__miter_base(__last),
628 #ifdef __GXX_EXPERIMENTAL_CXX0X__
647 template<
typename _BI1,
typename _BI2>
649 move_backward(_BI1 __first, _BI1 __last, _BI2 __result)
652 __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
653 __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
654 __glibcxx_function_requires(_ConvertibleConcept<
655 typename iterator_traits<_BI1>::value_type,
656 typename iterator_traits<_BI2>::value_type>)
657 __glibcxx_requires_valid_range(__first, __last);
659 return std::__copy_move_backward_a2<true>(std::__miter_base(__first),
660 std::__miter_base(__last),
664 #define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::move_backward(_Tp, _Up, _Vp)
666 #define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::copy_backward(_Tp, _Up, _Vp)
669 template<
typename _ForwardIterator,
typename _Tp>
671 __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value,
void>::__type
672 __fill_a(_ForwardIterator __first, _ForwardIterator __last,
675 for (; __first != __last; ++__first)
679 template<
typename _ForwardIterator,
typename _Tp>
681 __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value,
void>::__type
682 __fill_a(_ForwardIterator __first, _ForwardIterator __last,
685 const _Tp __tmp = __value;
686 for (; __first != __last; ++__first)
691 template<
typename _Tp>
693 __gnu_cxx::__enable_if<__is_byte<_Tp>::__value,
void>::__type
694 __fill_a(_Tp* __first, _Tp* __last,
const _Tp& __c)
696 const _Tp __tmp = __c;
697 __builtin_memset(__first, static_cast<unsigned char>(__tmp),
713 template<
typename _ForwardIterator,
typename _Tp>
715 fill(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __value)
718 __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
720 __glibcxx_requires_valid_range(__first, __last);
722 std::__fill_a(std::__niter_base(__first), std::__niter_base(__last),
726 template<
typename _OutputIterator,
typename _Size,
typename _Tp>
728 __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
729 __fill_n_a(_OutputIterator __first, _Size __n,
const _Tp& __value)
731 for (__decltype(__n + 0) __niter = __n;
732 __niter > 0; --__niter, ++__first)
737 template<
typename _OutputIterator,
typename _Size,
typename _Tp>
739 __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type
740 __fill_n_a(_OutputIterator __first, _Size __n,
const _Tp& __value)
742 const _Tp __tmp = __value;
743 for (__decltype(__n + 0) __niter = __n;
744 __niter > 0; --__niter, ++__first)
749 template<
typename _Size,
typename _Tp>
751 __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type
752 __fill_n_a(_Tp* __first, _Size __n,
const _Tp& __c)
754 std::__fill_a(__first, __first + __n, __c);
755 return __first + __n;
773 template<
typename _OI,
typename _Size,
typename _Tp>
775 fill_n(_OI __first, _Size __n,
const _Tp& __value)
778 __glibcxx_function_requires(_OutputIteratorConcept<_OI, _Tp>)
780 return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value));
783 template<
bool _BoolType>
786 template<
typename _II1,
typename _II2>
788 equal(_II1 __first1, _II1 __last1, _II2 __first2)
790 for (; __first1 != __last1; ++__first1, ++__first2)
791 if (!(*__first1 == *__first2))
800 template<
typename _Tp>
802 equal(
const _Tp* __first1,
const _Tp* __last1,
const _Tp* __first2)
804 return !__builtin_memcmp(__first1, __first2,
sizeof(_Tp)
805 * (__last1 - __first1));
809 template<
typename _II1,
typename _II2>
811 __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2)
813 typedef typename iterator_traits<_II1>::value_type _ValueType1;
814 typedef typename iterator_traits<_II2>::value_type _ValueType2;
815 const bool __simple = (__is_integer<_ValueType1>::__value
816 && __is_pointer<_II1>::__value
817 && __is_pointer<_II2>::__value
818 && __are_same<_ValueType1, _ValueType2>::__value);
824 template<
typename,
typename>
827 template<
typename _II1,
typename _II2>
829 __newlast1(_II1, _II1 __last1, _II2, _II2)
832 template<
typename _II>
834 __cnd2(_II __first, _II __last)
835 {
return __first != __last; }
839 struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag>
841 template<
typename _RAI1,
typename _RAI2>
843 __newlast1(_RAI1 __first1, _RAI1 __last1,
844 _RAI2 __first2, _RAI2 __last2)
846 const typename iterator_traits<_RAI1>::difference_type
847 __diff1 = __last1 - __first1;
848 const typename iterator_traits<_RAI2>::difference_type
849 __diff2 = __last2 - __first2;
850 return __diff2 < __diff1 ? __first1 + __diff2 : __last1;
853 template<
typename _RAI>
859 template<
bool _BoolType>
860 struct __lexicographical_compare
862 template<
typename _II1,
typename _II2>
863 static bool __lc(_II1, _II1, _II2, _II2);
866 template<
bool _BoolType>
867 template<
typename _II1,
typename _II2>
869 __lexicographical_compare<_BoolType>::
870 __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
872 typedef typename iterator_traits<_II1>::iterator_category _Category1;
873 typedef typename iterator_traits<_II2>::iterator_category _Category2;
874 typedef std::__lc_rai<_Category1, _Category2> __rai_type;
876 __last1 = __rai_type::__newlast1(__first1, __last1,
878 for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
879 ++__first1, ++__first2)
881 if (*__first1 < *__first2)
883 if (*__first2 < *__first1)
886 return __first1 == __last1 && __first2 != __last2;
890 struct __lexicographical_compare<true>
892 template<
typename _Tp,
typename _Up>
894 __lc(
const _Tp* __first1,
const _Tp* __last1,
895 const _Up* __first2,
const _Up* __last2)
897 const size_t __len1 = __last1 - __first1;
898 const size_t __len2 = __last2 - __first2;
899 const int __result = __builtin_memcmp(__first1, __first2,
901 return __result != 0 ? __result < 0 : __len1 < __len2;
905 template<
typename _II1,
typename _II2>
907 __lexicographical_compare_aux(_II1 __first1, _II1 __last1,
908 _II2 __first2, _II2 __last2)
910 typedef typename iterator_traits<_II1>::value_type _ValueType1;
911 typedef typename iterator_traits<_II2>::value_type _ValueType2;
912 const bool __simple =
913 (__is_byte<_ValueType1>::__value && __is_byte<_ValueType2>::__value
914 && !__gnu_cxx::__numeric_traits<_ValueType1>::__is_signed
915 && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed
916 && __is_pointer<_II1>::__value
917 && __is_pointer<_II2>::__value);
919 return std::__lexicographical_compare<__simple>::__lc(__first1, __last1,
934 template<
typename _ForwardIterator,
typename _Tp>
936 lower_bound(_ForwardIterator __first, _ForwardIterator __last,
939 typedef typename iterator_traits<_ForwardIterator>::value_type
941 typedef typename iterator_traits<_ForwardIterator>::difference_type
945 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
946 __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)
947 __glibcxx_requires_partitioned_lower(__first, __last, __val);
953 _DistanceType __half = __len >> 1;
954 _ForwardIterator __middle = __first;
956 if (*__middle < __val)
960 __len = __len - __half - 1;
970 template<
typename _Size>
975 for (__k = 0; __n != 0; __n >>= 1)
982 {
return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
986 {
return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); }
990 {
return sizeof(
long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); }
992 _GLIBCXX_END_NAMESPACE_VERSION
994 _GLIBCXX_BEGIN_NAMESPACE_ALGO
1008 template<
typename _II1,
typename _II2>
1010 equal(_II1 __first1, _II1 __last1, _II2 __first2)
1013 __glibcxx_function_requires(_InputIteratorConcept<_II1>)
1014 __glibcxx_function_requires(_InputIteratorConcept<_II2>)
1015 __glibcxx_function_requires(_EqualOpConcept<
1016 typename iterator_traits<_II1>::value_type,
1017 typename iterator_traits<_II2>::value_type>)
1018 __glibcxx_requires_valid_range(__first1, __last1);
1020 return std::__equal_aux(std::__niter_base(__first1),
1021 std::__niter_base(__last1),
1022 std::__niter_base(__first2));
1040 template<
typename _IIter1,
typename _IIter2,
typename _BinaryPredicate>
1042 equal(_IIter1 __first1, _IIter1 __last1,
1043 _IIter2 __first2, _BinaryPredicate __binary_pred)
1046 __glibcxx_function_requires(_InputIteratorConcept<_IIter1>)
1047 __glibcxx_function_requires(_InputIteratorConcept<_IIter2>)
1048 __glibcxx_requires_valid_range(__first1, __last1);
1050 for (; __first1 != __last1; ++__first1, ++__first2)
1051 if (!
bool(__binary_pred(*__first1, *__first2)))
1071 template<
typename _II1,
typename _II2>
1073 lexicographical_compare(_II1 __first1, _II1 __last1,
1074 _II2 __first2, _II2 __last2)
1077 typedef typename iterator_traits<_II1>::value_type _ValueType1;
1078 typedef typename iterator_traits<_II2>::value_type _ValueType2;
1079 __glibcxx_function_requires(_InputIteratorConcept<_II1>)
1080 __glibcxx_function_requires(_InputIteratorConcept<_II2>)
1081 __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
1082 __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
1083 __glibcxx_requires_valid_range(__first1, __last1);
1084 __glibcxx_requires_valid_range(__first2, __last2);
1086 return std::__lexicographical_compare_aux(std::__niter_base(__first1),
1087 std::__niter_base(__last1),
1088 std::__niter_base(__first2),
1089 std::__niter_base(__last2));
1105 template<
typename _II1,
typename _II2,
typename _Compare>
1107 lexicographical_compare(_II1 __first1, _II1 __last1,
1108 _II2 __first2, _II2 __last2, _Compare __comp)
1110 typedef typename iterator_traits<_II1>::iterator_category _Category1;
1111 typedef typename iterator_traits<_II2>::iterator_category _Category2;
1112 typedef std::__lc_rai<_Category1, _Category2> __rai_type;
1115 __glibcxx_function_requires(_InputIteratorConcept<_II1>)
1116 __glibcxx_function_requires(_InputIteratorConcept<_II2>)
1117 __glibcxx_requires_valid_range(__first1, __last1);
1118 __glibcxx_requires_valid_range(__first2, __last2);
1120 __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
1121 for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
1122 ++__first1, ++__first2)
1124 if (__comp(*__first1, *__first2))
1126 if (__comp(*__first2, *__first1))
1129 return __first1 == __last1 && __first2 != __last2;
1145 template<
typename _InputIterator1,
typename _InputIterator2>
1146 pair<_InputIterator1, _InputIterator2>
1147 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1148 _InputIterator2 __first2)
1151 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
1152 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
1153 __glibcxx_function_requires(_EqualOpConcept<
1154 typename iterator_traits<_InputIterator1>::value_type,
1155 typename iterator_traits<_InputIterator2>::value_type>)
1156 __glibcxx_requires_valid_range(__first1, __last1);
1158 while (__first1 != __last1 && *__first1 == *__first2)
1182 template<
typename _InputIterator1,
typename _InputIterator2,
1183 typename _BinaryPredicate>
1184 pair<_InputIterator1, _InputIterator2>
1185 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
1186 _InputIterator2 __first2, _BinaryPredicate __binary_pred)
1189 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
1190 __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
1191 __glibcxx_requires_valid_range(__first1, __last1);
1193 while (__first1 != __last1 &&
bool(__binary_pred(*__first1, *__first2)))
1201 _GLIBCXX_END_NAMESPACE_ALGO
1207 #ifdef _GLIBCXX_PARALLEL
Struct holding two objects of arbitrary type.
void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
Swaps the contents of two iterators.
const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
bool equal(_II1 __first1, _II1 __last1, _II2 __first2)
Tests a range for element-wise equality.
_OI move(_II __first, _II __last, _OI __result)
Moves the range [first,last) into result.
Parallel STL function calls corresponding to the stl_algobase.h header. The functions defined here ma...
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
_Size __lg(_Size __n)
This is a helper function for the sort routines and for random.tcc.
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
_OI copy(_II __first, _II __last, _OI __result)
Copies the range [first,last) into result.