void std::inplace_merge | ( | _BidirectionalIterator | __first, | |
_BidirectionalIterator | __middle, | |||
_BidirectionalIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Merges two sorted ranges in place.
first | An iterator. | |
middle | Another iterator. | |
last | Another iterator. | |
comp | A functor to use for comparisons. |
If enough additional memory is available, this takes (last-first)-1 comparisons. Otherwise an NlogN algorithm is used, where N is distance(first,last).
The comparison function should have the same effects on ordering as the function used for the initial sort.
Definition at line 3185 of file stl_algo.h.
References std::__merge_adaptive(), std::__merge_without_buffer(), std::_Temporary_buffer< _ForwardIterator, _Tp >::begin(), std::distance(), and std::_Temporary_buffer< _ForwardIterator, _Tp >::size().
void std::inplace_merge | ( | _BidirectionalIterator | __first, | |
_BidirectionalIterator | __middle, | |||
_BidirectionalIterator | __last | |||
) | [inline] |
Merges two sorted ranges in place.
If enough additional memory is available, this takes (last-first)-1 comparisons. Otherwise an NlogN algorithm is used, where N is distance(first,last).
Definition at line 3130 of file stl_algo.h.
References std::__merge_adaptive(), std::__merge_without_buffer(), std::_Temporary_buffer< _ForwardIterator, _Tp >::begin(), std::distance(), and std::_Temporary_buffer< _ForwardIterator, _Tp >::size().
bool std::is_sorted | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Determines whether the elements of a sequence are sorted according to a comparison functor.
Definition at line 3886 of file stl_algo.h.
References std::is_sorted_until().
bool std::is_sorted | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last | |||
) | [inline] |
Determines whether the elements of a sequence are sorted.
Definition at line 3872 of file stl_algo.h.
References std::is_sorted_until().
_ForwardIterator std::is_sorted_until | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Determines the end of a sorted sequence using comparison functor.
Definition at line 3929 of file stl_algo.h.
Referenced by std::is_sorted().
_ForwardIterator std::is_sorted_until | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last | |||
) | [inline] |
bool std::lexicographical_compare | ( | _II1 | __first1, | |
_II1 | __last1, | |||
_II2 | __first2, | |||
_II2 | __last2, | |||
_Compare | __comp | |||
) | [inline] |
Performs "dictionary" comparison on ranges.
first1 | An input iterator. | |
last1 | An input iterator. | |
first2 | An input iterator. | |
last2 | An input iterator. | |
comp | A comparison functor. |
lexicographical_compare
, but uses the comp parameter instead of <
.
Definition at line 1050 of file stl_algobase.h.
Referenced by std::operator<().
bool std::lexicographical_compare | ( | _II1 | __first1, | |
_II1 | __last1, | |||
_II2 | __first2, | |||
_II2 | __last2 | |||
) | [inline] |
Performs "dictionary" comparison on ranges.
first1 | An input iterator. | |
last1 | An input iterator. | |
first2 | An input iterator. | |
last2 | An input iterator. |
memcmp
.
Definition at line 1015 of file stl_algobase.h.
const _Tp & std::max | ( | const _Tp & | __a, | |
const _Tp & | __b, | |||
_Compare | __comp | |||
) | [inline] |
This does what you think it does.
a | A thing of arbitrary type. | |
b | Another thing of arbitrary type. | |
comp | A comparison functor. |
Definition at line 253 of file stl_algobase.h.
const _Tp & std::max | ( | const _Tp & | __a, | |
const _Tp & | __b | |||
) | [inline] |
This does what you think it does.
a | A thing of arbitrary type. | |
b | Another thing of arbitrary type. |
Definition at line 209 of file stl_algobase.h.
Referenced by std::tr1::__detail::__bessel_jn(), std::tr1::__detail::__ellint_rc(), std::tr1::__detail::__ellint_rd(), std::tr1::__detail::__ellint_rf(), std::tr1::__detail::__ellint_rj(), std::deque< _Tp, _Alloc >::_M_reallocate_map(), std::binomial_distribution< _IntType, _RealType >::operator()(), std::poisson_distribution< _IntType, _RealType >::operator()(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow().
_ForwardIterator std::max_element | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Return the maximum element in a range using comparison functor.
first | Start of range. | |
last | End of range. | |
comp | Comparison functor. |
Definition at line 6070 of file stl_algo.h.
Referenced by std::valarray< _Tp >::max().
_ForwardIterator std::max_element | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last | |||
) | [inline] |
Return the maximum element in a range.
first | Start of range. | |
last | End of range. |
Definition at line 6042 of file stl_algo.h.
_OutputIterator std::merge | ( | _InputIterator1 | __first1, | |
_InputIterator1 | __last1, | |||
_InputIterator2 | __first2, | |||
_InputIterator2 | __last2, | |||
_OutputIterator | __result, | |||
_Compare | __comp | |||
) | [inline] |
Merges two sorted ranges.
first1 | An iterator. | |
first2 | Another iterator. | |
last1 | Another iterator. | |
last2 | Another iterator. | |
result | An iterator pointing to the end of the merged range. | |
comp | A functor to use for comparisons. |
The comparison function should have the same effects on ordering as the function used for the initial sort.
Definition at line 5348 of file stl_algo.h.
_OutputIterator std::merge | ( | _InputIterator1 | __first1, | |
_InputIterator1 | __last1, | |||
_InputIterator2 | __first2, | |||
_InputIterator2 | __last2, | |||
_OutputIterator | __result | |||
) | [inline] |
Merges two sorted ranges.
first1 | An iterator. | |
first2 | Another iterator. | |
last1 | Another iterator. | |
last2 | Another iterator. | |
result | An iterator pointing to the end of the merged range. |
Definition at line 5285 of file stl_algo.h.
const _Tp & std::min | ( | const _Tp & | __a, | |
const _Tp & | __b, | |||
_Compare | __comp | |||
) | [inline] |
This does what you think it does.
a | A thing of arbitrary type. | |
b | Another thing of arbitrary type. | |
comp | A comparison functor. |
Definition at line 232 of file stl_algobase.h.
const _Tp & std::min | ( | const _Tp & | __a, | |
const _Tp & | __b | |||
) | [inline] |
This does what you think it does.
a | A thing of arbitrary type. | |
b | Another thing of arbitrary type. |
Definition at line 186 of file stl_algobase.h.
Referenced by std::tr1::__detail::__ellint_rc(), std::tr1::__detail::__ellint_rd(), std::tr1::__detail::__ellint_rf(), std::tr1::__detail::__ellint_rj(), std::tr1::__detail::__expint_En_cont_frac(), __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base >::compare(), std::basic_string< _CharT, _Traits, _Alloc >::compare(), std::basic_string< char >::compare(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), __gnu_parallel::parallel_random_shuffle_drs(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_string< _CharT, _Traits, _Alloc >::rfind(), __gnu_parallel::sequential_random_shuffle(), std::basic_filebuf< _CharT, _Traits >::underflow(), std::basic_streambuf< _CharT, _Traits >::xsgetn(), and std::basic_streambuf< _CharT, _Traits >::xsputn().
_ForwardIterator std::min_element | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Return the minimum element in a range using comparison functor.
first | Start of range. | |
last | End of range. | |
comp | Comparison functor. |
Definition at line 6014 of file stl_algo.h.
Referenced by std::valarray< _Tp >::min().
_ForwardIterator std::min_element | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last | |||
) | [inline] |
Return the minimum element in a range.
first | Start of range. | |
last | End of range. |
Definition at line 5986 of file stl_algo.h.
pair< const _Tp &, const _Tp & > std::minmax | ( | const _Tp & | __a, | |
const _Tp & | __b, | |||
_Compare | __comp | |||
) | [inline] |
Determines min and max at once as an ordered pair.
a | A thing of arbitrary type. | |
b | Another thing of arbitrary type. | |
comp | A comparison functor. |
Definition at line 3977 of file stl_algo.h.
References std::minmax().
pair< const _Tp &, const _Tp & > std::minmax | ( | const _Tp & | __a, | |
const _Tp & | __b | |||
) | [inline] |
Determines min and max at once as an ordered pair.
a | A thing of arbitrary type. | |
b | Another thing of arbitrary type. |
Definition at line 3958 of file stl_algo.h.
References std::minmax().
Referenced by std::minmax().
pair<_ForwardIterator, _ForwardIterator> std::minmax_element | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Return a pair of iterators pointing to the minimum and maximum elements in a range.
first | Start of range. | |
last | End of range. | |
comp | Comparison functor. |
Definition at line 4072 of file stl_algo.h.
pair<_ForwardIterator, _ForwardIterator> std::minmax_element | ( | _ForwardIterator | __first, | |
_ForwardIterator | __last | |||
) | [inline] |
Return a pair of iterators pointing to the minimum and maximum elements in a range.
first | Start of range. | |
last | End of range. |
Definition at line 3996 of file stl_algo.h.
bool std::next_permutation | ( | _BidirectionalIterator | __first, | |
_BidirectionalIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Permute range into the next "dictionary" ordering using comparison functor.
first | Start of range. | |
last | End of range. | |
comp | A comparison functor. |
Definition at line 3631 of file stl_algo.h.
References std::iter_swap(), and std::reverse().
bool std::next_permutation | ( | _BidirectionalIterator | __first, | |
_BidirectionalIterator | __last | |||
) | [inline] |
Permute range into the next "dictionary" ordering.
first | Start of range. | |
last | End of range. |
Definition at line 3574 of file stl_algo.h.
References std::iter_swap(), and std::reverse().
void std::nth_element | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __nth, | |||
_RandomAccessIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Sort a sequence just enough to find a particular position using a predicate for comparison.
first | An iterator. | |
nth | Another iterator. | |
last | Another iterator. | |
comp | A comparison functor. |
[first,last) so that *nth
is the same element that would have been in that position had the whole sequence been sorted. The elements either side of *nth
are not completely sorted, but for any iterator in the range
[first,nth) and any iterator in the range
[nth,last) it holds that comp(*j,*i)
is false.
Definition at line 5169 of file stl_algo.h.
References std::__lg().
void std::nth_element | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __nth, | |||
_RandomAccessIterator | __last | |||
) | [inline] |
Sort a sequence just enough to find a particular position.
[first,last) so that *nth
is the same element that would have been in that position had the whole sequence been sorted. whole sequence been sorted. The elements either side of *nth
are not completely sorted, but for any iterator in the range
[first,nth) and any iterator in the range
[nth,last) it holds that *j<*i
is false.
Definition at line 5130 of file stl_algo.h.
References std::__lg().
void std::partial_sort | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __middle, | |||
_RandomAccessIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Sort the smallest elements of a sequence using a predicate for comparison.
first | An iterator. | |
middle | Another iterator. | |
last | Another iterator. | |
comp | A comparison functor. |
(middle-first) elements in the range
[first,last) and moves them to the range
[first,middle). The order of the remaining elements in the range
[middle,last) is undefined. After the sort if i
and are iterators in the range
[first,middle) such that precedes and is an iterator in the range
[middle,last) then *comp
(j,*i) and comp(*k,*i)
are both false.
Definition at line 5092 of file stl_algo.h.
References std::__heap_select(), and std::sort_heap().
void std::partial_sort | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __middle, | |||
_RandomAccessIterator | __last | |||
) | [inline] |
Sort the smallest elements of a sequence.
(middle-first) elements in the range
[first,last) and moves them to the range
[first,middle). The order of the remaining elements in the range
[middle,last) is undefined. After the sort if i
and are iterators in the range
[first,middle) such that precedes and is an iterator in the range
[middle,last) then *j<*i
and *k<*i
are both false.
Definition at line 5053 of file stl_algo.h.
References std::__heap_select(), and std::sort_heap().
_RandomAccessIterator std::partial_sort_copy | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_RandomAccessIterator | __result_first, | |||
_RandomAccessIterator | __result_last, | |||
_Compare | __comp | |||
) | [inline] |
Copy the smallest elements of a sequence using a predicate for comparison.
first | An input iterator. | |
last | Another input iterator. | |
result_first | A random-access iterator. | |
result_last | Another random-access iterator. | |
comp | A comparison functor. |
[first,last) to the range beginning at result_first
, where the number of elements to be copied, N
, is the smaller of
(last-first) and
(result_last-result_first). After the sort if i
and are iterators in the range
[result_first,result_first+N) such that precedes then comp(*j,*i)
is false. The value returned is result_first+N
.
Definition at line 2011 of file stl_algo.h.
References std::make_heap(), and std::sort_heap().
_RandomAccessIterator std::partial_sort_copy | ( | _InputIterator | __first, | |
_InputIterator | __last, | |||
_RandomAccessIterator | __result_first, | |||
_RandomAccessIterator | __result_last | |||
) | [inline] |
Copy the smallest elements of a sequence.
first | An iterator. | |
last | Another iterator. | |
result_first | A random-access iterator. | |
result_last | Another random-access iterator. |
[first,last) to the range beginning at result_first
, where the number of elements to be copied, N
, is the smaller of
(last-first) and
(result_last-result_first). After the sort if i
and are iterators in the range
[result_first,result_first+N) such that precedes then *j<*i
is false. The value returned is result_first+N
.
Definition at line 1945 of file stl_algo.h.
References std::make_heap(), and std::sort_heap().
bool std::prev_permutation | ( | _BidirectionalIterator | __first, | |
_BidirectionalIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Permute range into the previous "dictionary" ordering using comparison functor.
first | Start of range. | |
last | End of range. | |
comp | A comparison functor. |
Definition at line 3744 of file stl_algo.h.
References std::iter_swap(), and std::reverse().
bool std::prev_permutation | ( | _BidirectionalIterator | __first, | |
_BidirectionalIterator | __last | |||
) | [inline] |
Permute range into the previous "dictionary" ordering.
first | Start of range. | |
last | End of range. |
Definition at line 3687 of file stl_algo.h.
References std::iter_swap(), and std::reverse().
void std::sort | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Sort the elements of a sequence using a predicate for comparison.
[first,last) in ascending order, such that comp
(*(i+1),*i) is false for every iterator i
in the range
[first,last-1).
The relative ordering of equivalent elements is not preserved, use stable_sort()
if this is needed.
Definition at line 5243 of file stl_algo.h.
References std::__final_insertion_sort(), std::__introsort_loop(), and std::__lg().
void std::sort | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __last | |||
) | [inline] |
Sort the elements of a sequence.
[first,last) in ascending order, such that *
(i+1)<*i is false for each iterator i
in the range
[first,last-1).
The relative ordering of equivalent elements is not preserved, use stable_sort()
if this is needed.
Definition at line 5207 of file stl_algo.h.
References std::__final_insertion_sort(), std::__introsort_loop(), and std::__lg().
void std::stable_sort | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __last, | |||
_Compare | __comp | |||
) | [inline] |
Sort the elements of a sequence using a predicate for comparison, preserving the relative order of equivalent elements.
[first,last) in ascending order, such that comp
(*(i+1),*i) is false for each iterator i
in the range
[first,last-1).
The relative ordering of equivalent elements is preserved, so any two elements x
and y
in the range [first,last) such that
comp(x,y)
is false and comp(y,x)
is false will have the same relative ordering after calling stable_sort()
.
Definition at line 5449 of file stl_algo.h.
References std::__inplace_stable_sort(), std::_Temporary_buffer< _ForwardIterator, _Tp >::begin(), and std::_Temporary_buffer< _ForwardIterator, _Tp >::size().
void std::stable_sort | ( | _RandomAccessIterator | __first, | |
_RandomAccessIterator | __last | |||
) | [inline] |
Sort the elements of a sequence, preserving the relative order of equivalent elements.
[first,last) in ascending order, such that *
(i+1)<*i is false for each iterator i
in the range
[first,last-1).
The relative ordering of equivalent elements is preserved, so any two elements x
and y
in the range [first,last) such that
x<y
is false and y<x
is false will have the same relative ordering after calling stable_sort()
.
Definition at line 5407 of file stl_algo.h.
References std::__inplace_stable_sort(), std::_Temporary_buffer< _ForwardIterator, _Tp >::begin(), and std::_Temporary_buffer< _ForwardIterator, _Tp >::size().