• Home
  • Raw
  • Download

Lines Matching refs:__first

837 all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
839 for (; __first != __last; ++__first)
840 if (!__pred(*__first))
850 any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
852 for (; __first != __last; ++__first)
853 if (__pred(*__first))
863 none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
865 for (; __first != __last; ++__first)
866 if (__pred(*__first))
876 for_each(_InputIterator __first, _InputIterator __last, _Function __f)
878 for (; __first != __last; ++__first)
879 __f(*__first);
888 find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
890 for (; __first != __last; ++__first)
891 if (*__first == __value_)
893 return __first;
901 find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
903 for (; __first != __last; ++__first)
904 if (__pred(*__first))
906 return __first;
914 find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred)
916 for (; __first != __last; ++__first)
917 if (!__pred(*__first))
919 return __first;
957 if (!__pred(*__m1, *__m2)) // mismatch, restart with a new __first
1109 adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
1111 if (__first != __last)
1113 _ForwardIterator __i = __first;
1116 if (__pred(*__first, *__i))
1117 return __first;
1118 __first = __i;
1127 adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
1130 return _VSTD::adjacent_find(__first, __last, __equal_to<__v>());
1138 count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
1141 for (; __first != __last; ++__first)
1142 if (*__first == __value_)
1152 count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
1155 for (; __first != __last; ++__first)
1156 if (__pred(*__first))
1553 __search_n(_ForwardIterator __first, _ForwardIterator __last,
1557 return __first;
1563 if (__first == __last) // return __last if no element matches __value_
1565 if (__pred(*__first, __value_))
1567 ++__first;
1569 // *__first matches __value_, now match elements after here
1570 _ForwardIterator __m = __first;
1574 …if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern)
1575 return __first;
1578 if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first
1580 __first = __m;
1581 ++__first;
1590 __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
1594 return __first;
1595 _Size __len = static_cast<_Size>(__last - __first);
1604 if (__first >= __s) // return __last if no element matches __value_
1606 if (__pred(*__first, __value_))
1608 ++__first;
1610 // *__first matches __value_, now match elements after here
1611 _RandomAccessIterator __m = __first;
1615 …if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern)
1616 return __first;
1618 if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first
1620 __first = __m;
1621 ++__first;
1631 search_n(_ForwardIterator __first, _ForwardIterator __last,
1635 (__first, __last, __convert_to_integral(__count), __value_, __pred,
1642 search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
1645 return _VSTD::search_n(__first, __last, __convert_to_integral(__count),
1703 __copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1705 for (; __first != __last; ++__first, (void) ++__result)
1706 *__result = *__first;
1718 __copy(_Tp* __first, _Tp* __last, _Up* __result)
1720 const size_t __n = static_cast<size_t>(__last - __first);
1722 _VSTD::memmove(__result, __first, __n * sizeof(_Up));
1729 copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1731 return _VSTD::__copy(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
1739 __copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __re…
1741 while (__first != __last)
1754 __copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
1756 const size_t __n = static_cast<size_t>(__last - __first);
1760 _VSTD::memmove(__result, __first, __n * sizeof(_Up));
1768 copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
1771 return _VSTD::__copy_backward(__unwrap_iter(__first),
1781 copy_if(_InputIterator __first, _InputIterator __last,
1784 for (; __first != __last; ++__first)
1786 if (__pred(*__first))
1788 *__result = *__first;
1805 copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
1811 *__result = *__first;
1815 ++__first;
1816 *__result = *__first;
1830 copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
1834 return _VSTD::copy(__first, __first + __n, __result);
1842 __move(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1844 for (; __first != __last; ++__first, (void) ++__result)
1845 *__result = _VSTD::move(*__first);
1857 __move(_Tp* __first, _Tp* __last, _Up* __result)
1859 const size_t __n = static_cast<size_t>(__last - __first);
1861 _VSTD::memmove(__result, __first, __n * sizeof(_Up));
1868 move(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1870 return _VSTD::__move(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result));
1878 __move_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
1880 while (__first != __last)
1893 __move_backward(_Tp* __first, _Tp* __last, _Up* __result)
1895 const size_t __n = static_cast<size_t>(__last - __first);
1899 _VSTD::memmove(__result, __first, __n * sizeof(_Up));
1907 move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
1910 …return _VSTD::__move_backward(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__resul…
1922 transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation …
1924 for (; __first != __last; ++__first, (void) ++__result)
1925 *__result = __op(*__first);
1945 replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new…
1947 for (; __first != __last; ++__first)
1948 if (*__first == __old_value)
1949 *__first = __new_value;
1957 replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_v…
1959 for (; __first != __last; ++__first)
1960 if (__pred(*__first))
1961 *__first = __new_value;
1969 replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
1972 for (; __first != __last; ++__first, (void) ++__result)
1973 if (*__first == __old_value)
1976 *__result = *__first;
1985 replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
1988 for (; __first != __last; ++__first, (void) ++__result)
1989 if (__pred(*__first))
1992 *__result = *__first;
2001 __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
2003 for (; __n > 0; ++__first, (void) --__n)
2004 *__first = __value_;
2005 return __first;
2017 __fill_n(_Tp* __first, _Size __n,_Up __value_)
2020 _VSTD::memset(__first, (unsigned char)__value_, (size_t)(__n));
2021 return __first + __n;
2027 fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
2029 return _VSTD::__fill_n(__first, __convert_to_integral(__n), __value_);
2037 __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, forward_iterator_tag)
2039 for (; __first != __last; ++__first)
2040 *__first = __value_;
2046 __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value_, random_acc…
2048 _VSTD::fill_n(__first, __last - __first, __value_);
2054 fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
2056 …_VSTD::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_cate…
2064 generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
2066 for (; __first != __last; ++__first)
2067 *__first = __gen();
2075 generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
2079 for (; __n > 0; ++__first, (void) --__n)
2080 *__first = __gen();
2081 return __first;
2088 remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
2090 __first = _VSTD::find(__first, __last, __value_);
2091 if (__first != __last)
2093 _ForwardIterator __i = __first;
2098 *__first = _VSTD::move(*__i);
2099 ++__first;
2103 return __first;
2110 remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
2112 __first = _VSTD::find_if<_ForwardIterator, typename add_lvalue_reference<_Predicate>::type>
2113 (__first, __last, __pred);
2114 if (__first != __last)
2116 _ForwardIterator __i = __first;
2121 *__first = _VSTD::move(*__i);
2122 ++__first;
2126 return __first;
2134 remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __v…
2136 for (; __first != __last; ++__first)
2138 if (!(*__first == __value_))
2140 *__result = *__first;
2152 remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate …
2154 for (; __first != __last; ++__first)
2156 if (!__pred(*__first))
2158 *__result = *__first;
2169 unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred)
2171__first = _VSTD::adjacent_find<_ForwardIterator, typename add_lvalue_reference<_BinaryPredicate>::…
2172 (__first, __last, __pred);
2173 if (__first != __last)
2177 _ForwardIterator __i = __first;
2179 if (!__pred(*__first, *__i))
2180 *++__first = _VSTD::move(*__i);
2181 ++__first;
2183 return __first;
2189 unique(_ForwardIterator __first, _ForwardIterator __last)
2192 return _VSTD::unique(__first, __last, __equal_to<__v>());
2199 __unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredi…
2202 if (__first != __last)
2204 typename iterator_traits<_InputIterator>::value_type __t(*__first);
2207 while (++__first != __last)
2209 if (!__pred(__t, *__first))
2211 __t = *__first;
2222 __unique_copy(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, _BinaryP…
2225 if (__first != __last)
2227 _ForwardIterator __i = __first;
2230 while (++__first != __last)
2232 if (!__pred(*__i, *__first))
2234 *__result = *__first;
2236 __i = __first;
2245 __unique_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _BinaryPred…
2248 if (__first != __last)
2250 *__result = *__first;
2251 while (++__first != __last)
2252 if (!__pred(*__result, *__first))
2253 *++__result = *__first;
2262 unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredica…
2265 (__first, __last, __result, __pred,
2273 unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
2276 return _VSTD::unique_copy(__first, __last, __result, __equal_to<__v>());
2284 __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag)
2286 while (__first != __last)
2288 if (__first == --__last)
2290 _VSTD::iter_swap(__first, __last);
2291 ++__first;
2298 __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag)
2300 if (__first != __last)
2301 for (; __first < --__last; ++__first)
2302 _VSTD::iter_swap(__first, __last);
2308 reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
2310 …_VSTD::__reverse(__first, __last, typename iterator_traits<_BidirectionalIterator>::iterator_categ…
2318 reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __resul…
2320 for (; __first != __last; ++__result)
2329 __rotate_left(_ForwardIterator __first, _ForwardIterator __last)
2332 value_type __tmp = _VSTD::move(*__first);
2333 _ForwardIterator __lm1 = _VSTD::move(_VSTD::next(__first), __last, __first);
2340 __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
2345 _BidirectionalIterator __fp1 = _VSTD::move_backward(__first, __lm1, __last);
2346 *__first = _VSTD::move(__tmp);
2352 __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
2357 swap(*__first, *__i);
2358 ++__first;
2361 if (__first == __middle)
2364 _ForwardIterator __r = __first;
2365 if (__first != __middle)
2370 swap(*__first, *__i);
2371 ++__first;
2374 if (__first == __middle)
2378 else if (__first == __middle)
2401 __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator _…
2406 const difference_type __m1 = __middle - __first;
2410 _VSTD::swap_ranges(__first, __middle, __middle);
2414 for (_RandomAccessIterator __p = __first + __g; __p != __first;)
2427 __p2 = __first + (__m1 - __d);
2431 return __first + __m2;
2437 __rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
2443 if (_VSTD::next(__first) == __middle)
2444 return _VSTD::__rotate_left(__first, __last);
2446 return _VSTD::__rotate_forward(__first, __middle, __last);
2452 __rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __…
2458 if (_VSTD::next(__first) == __middle)
2459 return _VSTD::__rotate_left(__first, __last);
2461 return _VSTD::__rotate_right(__first, __last);
2463 return _VSTD::__rotate_forward(__first, __middle, __last);
2469 __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __las…
2475 if (_VSTD::next(__first) == __middle)
2476 return _VSTD::__rotate_left(__first, __last);
2478 return _VSTD::__rotate_right(__first, __last);
2479 return _VSTD::__rotate_gcd(__first, __middle, __last);
2481 return _VSTD::__rotate_forward(__first, __middle, __last);
2487 rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
2489 if (__first == __middle)
2492 return __first;
2493 return _VSTD::__rotate(__first, __middle, __last,
2502 rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIt…
2504 return _VSTD::copy(__first, __middle, _VSTD::copy(__middle, __last, __result));
2512 min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2514 if (__first != __last)
2516 _ForwardIterator __i = __first;
2518 if (__comp(*__i, *__first))
2519 __first = __i;
2521 return __first;
2527 min_element(_ForwardIterator __first, _ForwardIterator __last)
2529 return _VSTD::min_element(__first, __last,
2576 max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2578 if (__first != __last)
2580 _ForwardIterator __i = __first;
2582 if (__comp(*__first, *__i))
2583 __first = __i;
2585 return __first;
2592 max_element(_ForwardIterator __first, _ForwardIterator __last)
2594 return _VSTD::max_element(__first, __last,
2662 minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
2664 std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first);
2665 if (__first != __last)
2667 if (++__first != __last)
2669 if (__comp(*__first, *__result.first))
2670 __result.first = __first;
2672 __result.second = __first;
2673 while (++__first != __last)
2675 _ForwardIterator __i = __first;
2676 if (++__first == __last)
2686 if (__comp(*__first, *__i))
2688 if (__comp(*__first, *__result.first))
2689 __result.first = __first;
2697 if (!__comp(*__first, *__result.second))
2698 __result.second = __first;
2710 minmax_element(_ForwardIterator __first, _ForwardIterator __last)
2712 return _VSTD::minmax_element(__first, __last,
2743 _Iter __first = __t.begin();
2745 std::pair<_Tp, _Tp> __result(*__first, *__first);
2747 ++__first;
2750 if (__comp(*__first, __result.first))
2751 __result.first = *__first;
2753 __result.second = *__first;
2754 ++__first;
2757 while (__first != __last)
2759 _Tp __prev = *__first++;
2760 if (__comp(*__first, __prev)) {
2761 if ( __comp(*__first, __result.first)) __result.first = *__first;
2766 if (!__comp(*__first, __result.second)) __result.second = *__first;
2769 __first++;
3059 random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
3064 difference_type __d = __last - __first;
3069 for (--__last, --__d; __first < __last; ++__first, --__d)
3073 swap(*__first, *(__first + __i));
3080 random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
3088 difference_type __d = __last - __first;
3091 for (--__last; __first < __last; ++__first, --__d)
3094 swap(*__first, *(__first + __i));
3102 _SampleIterator __sample(_PopulationIterator __first,
3109 for (; __first != __last && __k < __n; ++__first, (void)++__k)
3110 __output[__k] = *__first;
3112 for (; __first != __last; ++__first, (void)++__k) {
3115 __output[__r] = *__first;
3123 _SampleIterator __sample(_PopulationIterator __first,
3128 _Distance __unsampled_sz = _VSTD::distance(__first, __last);
3129 for (__n = _VSTD::min(__n, __unsampled_sz); __n != 0; ++__first) {
3133 *__output++ = *__first;
3143 _SampleIterator __sample(_PopulationIterator __first,
3156 __first, __last, __output, _CommonType(__n),
3164 _SampleIterator sample(_PopulationIterator __first,
3167 return _VSTD::__sample(__first, __last, __output, __n, __g);
3172 void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
3182 difference_type __d = __last - __first;
3186 for (--__last, --__d; __first < __last; ++__first, --__d)
3190 swap(*__first, *(__first + __i));
3197 is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
3199 for (; __first != __last; ++__first)
3200 if (!__pred(*__first))
3202 if ( __first == __last )
3204 ++__first;
3205 for (; __first != __last; ++__first)
3206 if (__pred(*__first))
3215 __partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_…
3219 if (__first == __last)
3220 return __first;
3221 if (!__pred(*__first))
3223 ++__first;
3225 for (_ForwardIterator __p = __first; ++__p != __last;)
3229 swap(*__first, *__p);
3230 ++__first;
3233 return __first;
3238 __partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
3245 if (__first == __last)
3246 return __first;
3247 if (!__pred(*__first))
3249 ++__first;
3253 if (__first == --__last)
3254 return __first;
3256 swap(*__first, *__last);
3257 ++__first;
3264 partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
3267 … (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
3275 partition_copy(_InputIterator __first, _InputIterator __last,
3279 for (; __first != __last; ++__first)
3281 if (__pred(*__first))
3283 *__out_true = *__first;
3288 *__out_false = *__first;
3299 partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
3302 difference_type __len = _VSTD::distance(__first, __last);
3306 _ForwardIterator __m = __first;
3310 __first = ++__m;
3316 return __first;
3323 __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
3326 // *__first is known to be false
3329 return __first;
3332 _ForwardIterator __m = __first;
3335 swap(*__first, *__m);
3338 return __first;
3346 // Update __first to always point to the end of the trues
3348 ::new(__t) value_type(_VSTD::move(*__first));
3351 _ForwardIterator __i = __first;
3356 *__first = _VSTD::move(*__i);
3357 ++__first;
3367 // Move falses back into range, but don't mess up __first which points to first false
3368 __i = __first;
3372 return __first;
3376 _ForwardIterator __m = __first;
3379 // recurse on [__first, __m), *__first know to be false
3383 …_ForwardIterator __first_false = __stable_partition<_PredRef>(__first, __m, __pred, __len2, __p, _…
3415 __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
3419 // Either prove all true and return __first or point to first false
3422 if (__first == __last)
3423 return __first;
3424 if (!__pred(*__first))
3426 ++__first;
3428 // We now have a reduced range [__first, __last)
3429 // *__first is known to be false
3432 difference_type __len = _VSTD::distance(__first, __last);
3441 (__first, __last, __pred, __len, __p, forward_iterator_tag());
3446 __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
3449 // *__first is known to be false
3454 swap(*__first, *__last);
3459 _BidirectionalIterator __m = __first;
3462 swap(*__first, *__m);
3467 swap(*__first, *__m);
3476 // Update __first to always point to the end of the trues
3478 ::new(__t) value_type(_VSTD::move(*__first));
3481 _BidirectionalIterator __i = __first;
3486 *__first = _VSTD::move(*__i);
3487 ++__first;
3497 *__first = _VSTD::move(*__i);
3498 __i = ++__first;
3500 // Move falses back into range, but don't mess up __first which points to first false
3504 return __first;
3508 _BidirectionalIterator __m = __first;
3511 …// recurse on [__first, __m-1], except reduce __m-1 until *(__m-1) is true, *__first know to be fa…
3515 _BidirectionalIterator __first_false = __first;
3519 if (__m1 == __first)
3526 __first_false = __stable_partition<_PredRef>(__first, __m1, __pred, __len_half, __p, __bit);
3554 __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred,
3560 // Either prove all true and return __first or point to first false
3563 if (__first == __last)
3564 return __first;
3565 if (!__pred(*__first))
3567 ++__first;
3569 // __first points to first false, everything prior to __first is already set.
3570 // Either prove [__first, __last) is all false and return __first, or point __last to last true
3573 if (__first == --__last)
3574 return __first;
3576 // We now have a reduced range [__first, __last]
3577 // *__first is known to be false
3580 difference_type __len = _VSTD::distance(__first, __last) + 1;
3589 (__first, __last, __pred, __len, __p, bidirectional_iterator_tag());
3595 stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
3598 … (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
3605 is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
3607 if (__first != __last)
3609 _ForwardIterator __i = __first;
3612 if (__comp(*__i, *__first))
3614 __first = __i;
3623 is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
3625 …return _VSTD::is_sorted_until(__first, __last, __less<typename iterator_traits<_ForwardIterator>::…
3633 is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
3635 return _VSTD::is_sorted_until(__first, __last, __comp) == __last;
3641 is_sorted(_ForwardIterator __first, _ForwardIterator __last)
3643 …return _VSTD::is_sorted(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_…
3745 __selection_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp)
3748 for (--__lm1; __first != __lm1; ++__first)
3752 (__first, __last, __comp);
3753 if (__i != __first)
3754 swap(*__first, *__i);
3760 __insertion_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp)
3763 if (__first != __last)
3765 _BirdirectionalIterator __i = __first;
3770 for (_BirdirectionalIterator __k = __i; __k != __first && __comp(__t, *--__k); --__j)
3779 __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
3782 _RandomAccessIterator __j = __first+2;
3783 __sort3<_Compare>(__first, __first+1, __j, __comp);
3795 } while (__j != __first && __comp(__t, *--__k));
3804 __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare _…
3806 switch (__last - __first)
3812 if (__comp(*--__last, *__first))
3813 swap(*__first, *__last);
3816 _VSTD::__sort3<_Compare>(__first, __first+1, --__last, __comp);
3819 _VSTD::__sort4<_Compare>(__first, __first+1, __first+2, --__last, __comp);
3822 _VSTD::__sort5<_Compare>(__first, __first+1, __first+2, __first+3, --__last, __comp);
3826 _RandomAccessIterator __j = __first+2;
3827 __sort3<_Compare>(__first, __first+1, __j, __comp);
3841 } while (__j != __first && __comp(__t, *--__k));
3888 __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
3898 difference_type __len = __last - __first;
3905 if (__comp(*--__last, *__first))
3906 swap(*__first, *__last);
3909 _VSTD::__sort3<_Compare>(__first, __first+1, --__last, __comp);
3912 _VSTD::__sort4<_Compare>(__first, __first+1, __first+2, --__last, __comp);
3915 _VSTD::__sort5<_Compare>(__first, __first+1, __first+2, __first+3, --__last, __comp);
3920 _VSTD::__insertion_sort_3<_Compare>(__first, __last, __comp);
3924 _RandomAccessIterator __m = __first;
3935 … __n_swaps = _VSTD::__sort5<_Compare>(__first, __first + __delta, __m, __m+__delta, __lm1, __comp);
3941 __n_swaps = _VSTD::__sort3<_Compare>(__first, __m, __lm1, __comp);
3945 // partition [__first, __m) < *__m and *__m <= [__m, __last)
3947 _RandomAccessIterator __i = __first;
3952 if (!__comp(*__i, *__m)) // if *__first == *__m
3954 // *__first == *__m, *__first doesn't go in first part
3960 // *__first == *__m, *__m <= all other elements
3961 // Parition instead into [__first, __i) == *__first and *__first < [__i, __last)
3962 ++__i; // __first + 1
3964 if (!__comp(*__first, *--__j)) // we need a guard if *__first == *(__last-1)
3969 return; // [__first, __last) all equivalent elements
3970 if (__comp(*__first, *__i))
3980 // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1
3985 while (!__comp(*__first, *__i))
3987 while (__comp(*__first, *--__j))
3995 // [__first, __i) == *__first and *__first < [__i, __last)
3998 __first = __i;
4036 // [__first, __i) < *__m and *__m <= [__i, __last)
4042 // [__first, __i) < *__i and *__i <= [__i+1, __last)
4046 bool __fs = _VSTD::__insertion_sort_incomplete<_Compare>(__first, __i, __comp);
4058 __first = ++__i;
4064 if (__i - __first < __last - __i)
4066 _VSTD::__sort<_Compare>(__first, __i, __comp);
4068 __first = ++__i;
4073 // _VSTD::__sort<_Compare>(__first, __i, __comp);
4083 sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4088 __sort<_Comp_ref>(__first, __last, __c);
4091 __sort<_Comp_ref>(__first, __last, __comp);
4098 sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
4100 …_VSTD::sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()…
4106 sort(_Tp** __first, _Tp** __last)
4108 _VSTD::sort((size_t*)__first, (size_t*)__last, __less<size_t>());
4114 sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last)
4116 _VSTD::sort(__first.base(), __last.base());
4122 sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
4125 _VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
4173 __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __co…
4176 difference_type __len = _VSTD::distance(__first, __last);
4180 _ForwardIterator __m = __first;
4184 __first = ++__m;
4190 return __first;
4196 lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
4201 return __lower_bound<_Comp_ref>(__first, __last, __value_, __c);
4204 return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp);
4211 lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
4213 return _VSTD::lower_bound(__first, __last, __value_,
4221 __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __co…
4224 difference_type __len = _VSTD::distance(__first, __last);
4228 _ForwardIterator __m = __first;
4234 __first = ++__m;
4238 return __first;
4244 upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
4249 return __upper_bound<_Comp_ref>(__first, __last, __value_, __c);
4252 return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp);
4259 upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
4261 return _VSTD::upper_bound(__first, __last, __value_,
4269 __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __co…
4272 difference_type __len = _VSTD::distance(__first, __last);
4276 _ForwardIterator __m = __first;
4280 __first = ++__m;
4293 __lower_bound<_Compare>(__first, __m, __value_, __comp),
4298 return pair<_ForwardIterator, _ForwardIterator>(__first, __first);
4304 equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
4309 return __equal_range<_Comp_ref>(__first, __last, __value_, __c);
4312 return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);
4319 equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
4321 return _VSTD::equal_range(__first, __last, __value_,
4330 __binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __…
4332 __first = __lower_bound<_Compare>(__first, __last, __value_, __comp);
4333 return __first != __last && !__comp(__value_, *__first);
4339 binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __co…
4344 return __binary_search<_Comp_ref>(__first, __last, __value_, __c);
4347 return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);
4354 binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
4356 return _VSTD::binary_search(__first, __last, __value_,
4444 __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _Bidirect…
4455 …for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++_…
4457 __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);
4467 _RBi(__middle), _RBi(__first),
4474 __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIter…
4487 (__first, __middle, __last, __comp, __len1, __len2, __buff);
4488 … // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
4489 for (; true; ++__first, (void) --__len1)
4493 if (__comp(*__middle, *__first))
4496 // __first < __middle < __last
4497 // *__first > *__middle
4498 // partition [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) such that
4500 // [__first, __m1) <= [__middle, __m2)
4504 _BidirectionalIterator __m1; // "median" of [__first, __middle)
4506 difference_type __len11; // distance(__first, __m1)
4514 __m1 = __upper_bound<_Compare>(__first, __middle, *__m2, __comp);
4515 __len11 = _VSTD::distance(__first, __m1);
4521 // It is known *__first > *__middle
4522 swap(*__first, *__middle);
4527 __m1 = __first;
4534 // [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last)
4541 … __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size);
4543 __first = __middle;
4551 // __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __…
4563 inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterat…
4568 difference_type __len1 = _VSTD::distance(__first, __middle);
4577 return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __c, __len1, __len2,
4581 return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
4589 inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterat…
4591 _VSTD::inplace_merge(__first, __middle, __last,
4668 __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
4726 __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
4738 if (__comp(*--__last, *__first))
4739 swap(*__first, *__last);
4744 __insertion_sort<_Compare>(__first, __last, __comp);
4748 _RandomAccessIterator __m = __first + __l2;
4753 __stable_sort_move<_Compare>(__first, __m, __comp, __l2, __buff);
4757 …__merge_move_assign<_Compare>(__buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __com…
4762 // __first, __comp);
4765 __stable_sort<_Compare>(__first, __m, __comp, __l2, __buff, __buff_size);
4767 … __inplace_merge<_Compare>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size);
4773 stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4777 difference_type __len = __last - __first;
4788 __stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
4791 __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
4798 stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
4800 …_VSTD::stable_sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_…
4807 is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4810 difference_type __len = __last - __first;
4813 _RandomAccessIterator __pp = __first;
4816 _RandomAccessIterator __cp = __first + __c;
4835 is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
4837 …return _VSTD::is_heap_until(__first, __last, __less<typename iterator_traits<_RandomAccessIterator…
4845 is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4847 return _VSTD::is_heap_until(__first, __last, __comp) == __last;
4853 is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
4855 …return _VSTD::is_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::val…
4862 __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
4869 _RandomAccessIterator __ptr = __first + __len;
4880 __ptr = __first + __len;
4890 push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4895 __sift_up<_Comp_ref>(__first, __last, __c, __last - __first);
4898 __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first);
4905 push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
4907 …_VSTD::push_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_ty…
4914 __sift_down(_RandomAccessIterator __first, _RandomAccessIterator /*__last*/,
4923 difference_type __child = __start - __first;
4929 _RandomAccessIterator __child_i = __first + __child;
4954 __child_i = __first + __child;
4970 __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
4975 swap(*__first, *--__last);
4976 __sift_down<_Compare>(__first, __last, __comp, __len - 1, __first);
4983 pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
4988 __pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
4991 __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
4998 pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
5000 …_VSTD::pop_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_typ…
5007 __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
5010 difference_type __n = __last - __first;
5016 __sift_down<_Compare>(__first, __last, __comp, __n, __first + __start);
5024 make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
5029 __make_heap<_Comp_ref>(__first, __last, __c);
5032 __make_heap<_Comp_ref>(__first, __last, __comp);
5039 make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
5041 …_VSTD::make_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_ty…
5048 __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
5051 for (difference_type __n = __last - __first; __n > 1; --__last, --__n)
5052 __pop_heap<_Compare>(__first, __last, __comp, __n);
5058 sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
5063 __sort_heap<_Comp_ref>(__first, __last, __c);
5066 __sort_heap<_Comp_ref>(__first, __last, __comp);
5073 sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
5075 …_VSTD::sort_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_ty…
5082 __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator…
5085 __make_heap<_Compare>(__first, __middle, __comp);
5086 typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first;
5089 if (__comp(*__i, *__first))
5091 swap(*__i, *__first);
5092 __sift_down<_Compare>(__first, __middle, __comp, __len, __first);
5095 __sort_heap<_Compare>(__first, __middle, __comp);
5101 partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator _…
5107 __partial_sort<_Comp_ref>(__first, __middle, __last, __c);
5110 __partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
5117 partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator _…
5119 _VSTD::partial_sort(__first, __middle, __last,
5127 __partial_sort_copy(_InputIterator __first, _InputIterator __last,
5133 for (; __first != __last && __r != __result_last; (void) ++__first, ++__r)
5134 *__r = *__first;
5137 for (; __first != __last; ++__first)
5138 if (__comp(*__first, *__result_first))
5140 *__result_first = *__first;
5151 partial_sort_copy(_InputIterator __first, _InputIterator __last,
5157 return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
5160 return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
5167 partial_sort_copy(_InputIterator __first, _InputIterator __last,
5170 return _VSTD::partial_sort_copy(__first, __last, __result_first, __result_last,
5178 __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __l…
5188 difference_type __len = __last - __first;
5195 if (__comp(*--__last, *__first))
5196 swap(*__first, *__last);
5200 _RandomAccessIterator __m = __first;
5201 _VSTD::__sort3<_Compare>(__first, ++__m, --__last, __comp);
5207 __selection_sort<_Compare>(__first, __last, __comp);
5211 _RandomAccessIterator __m = __first + __len/2;
5213 unsigned __n_swaps = _VSTD::__sort3<_Compare>(__first, __m, --__lm1, __comp);
5215 // partition [__first, __m) < *__m and *__m <= [__m, __last)
5217 _RandomAccessIterator __i = __first;
5222 if (!__comp(*__i, *__m)) // if *__first == *__m
5224 // *__first == *__m, *__first doesn't go in first part
5230 // *__first == *__m, *__m <= all other elements
5231 // Parition instead into [__first, __i) == *__first and *__first < [__i, __last)
5232 ++__i; // __first + 1
5234 if (!__comp(*__first, *--__j)) // we need a guard if *__first == *(__last-1)
5239 return; // [__first, __last) all equivalent elements
5240 if (__comp(*__first, *__i))
5250 // [__first, __i) == *__first and *__first < [__j, __last) and __j == __last - 1
5255 while (!__comp(*__first, *__i))
5257 while (__comp(*__first, *--__j))
5265 // [__first, __i) == *__first and *__first < [__i, __last)
5271 __first = __i;
5307 // [__first, __i) < *__m and *__m <= [__i, __last)
5313 // [__first, __i) < *__i and *__i <= [__i+1, __last)
5321 // Check for [__first, __i) already sorted
5322 __j = __m = __first;
5330 // [__first, __i) sorted
5352 // __nth_element<_Compare>(__first, __nth, __i, __comp);
5358 __first = ++__i;
5366 nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __las…
5371 __nth_element<_Comp_ref>(__first, __nth, __last, __c);
5374 __nth_element<_Comp_ref>(__first, __nth, __last, __comp);
5381 nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __las…
5383 …_VSTD::nth_element(__first, __nth, __last, __less<typename iterator_traits<_RandomAccessIterator>:…
5696 __next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
5699 if (__first == __last || __first == --__i)
5713 if (__i == __first)
5715 _VSTD::reverse(__first, __last);
5724 next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
5729 return __next_permutation<_Comp_ref>(__first, __last, __c);
5732 return __next_permutation<_Comp_ref>(__first, __last, __comp);
5739 next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
5741 return _VSTD::next_permutation(__first, __last,
5749 __prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
5752 if (__first == __last || __first == --__i)
5766 if (__i == __first)
5768 _VSTD::reverse(__first, __last);
5777 prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
5782 return __prev_permutation<_Comp_ref>(__first, __last, __c);
5785 return __prev_permutation<_Comp_ref>(__first, __last, __comp);
5792 prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
5794 return _VSTD::prev_permutation(__first, __last,