C++ STL Algorithms

来源:互联网 发布:android串口编程实例 编辑:程序博客网 时间:2024/05/05 00:42
accumulatesum up a range of elementsadjacent_differencecompute the differences between adjacent elements in a rangeadjacent_findfinds two items that are adjacent to eachotherbinary_searchdetermine if an element exists in a certain rangecopycopy some range of elements to a new locationcopy_backwardcopy a range of elements in backwards ordercopy_ncopy N elementscountreturn the number of elements matching a given valuecount_ifreturn the number of elements for which a predicate is trueequaldetermine if two sets of elements are the sameequal_rangesearch for a range of elements that are all equal to a certain element fillassign a range of elements a certain valuefill_nassign a value to some number of elementsfindfind a value in a given rangefind_endfind the last sequence of elements in a certain rangefind_first_ofsearch for any one of a set of elementsfind_iffind the first element for which a certain predicate is truefor_eachapply a function to a range of elementsgeneratesaves the result of a function in a rangegenerate_nsaves the result of N applications of a functionincludesreturns true if one set is a subset of anotherinner_productcompute the inner product of two ranges of elementsinplace_mergemerge two ordered ranges in-placeiotaassign increasing values to a range of elementsis_heapreturns true if a given range is a heapis_sortedreturns true if a range is sorted in ascending orderiter_swapswaps the elements pointed to by two iteratorslexicographical_comparereturns true if one range is lexicographically less than anotherlexicographical_compare_3waydetermines if one range is lexicographically less than or greater than anotherlower_boundsearch for the first place that a value can be inserted while preserving ordermake_heapcreates a heap out of a range of elementsmaxreturns the larger of two elementsmax_elementreturns the largest element in a rangemergemerge two sorted rangesminreturns the smaller of two elementsmin_elementreturns the smallest element in a rangemismatchfinds the first position where two ranges differnext_permutationgenerates the next greater lexicographic permutation of a range of elementsnth_elementput one element in its sorted location and make sure that no elements to its left are greater than any elements to its rightpartial_sortsort the first N elements of a rangepartial_sort_copycopy and partially sort a range of elementspartial_sumcompute the partial sum of a range of elementspartitiondivide a range of elements into two groupspop_heapremove the largest element from a heappowercompute the value of some number raised to the Nth powerprev_permutationgenerates the next smaller lexicographic permutation of a range of elementspush_heapadd an element to a heaprandom_samplerandomly copy elements from one range to anotherrandom_sample_nsample N random elements from a rangerandom_shufflerandomly re-order elements in some rangeremoveremove elements equal to certain valueremove_copycopy a range of elements omitting those that match a certian valueremove_copy_ifcreate a copy of a range of elements, omitting any for which a predicate is trueremove_ifremove all elements for which a predicate is truereplacereplace every occurrence of some value in a range with another valuereplace_copycopy a range, replacing certain elements with new onesreplace_copy_ifcopy a range of elements, replacing those for which a predicate is truereplace_ifchange the values of elements for which a predicate is true reversereverse elements in some rangereverse_copycreate a copy of a range that is reversedrotatemove the elements in some range to the left by some amountrotate_copycopy and rotate a range of elementssearchsearch for a range of elementssearch_nsearch for N consecutive copies of an element in some rangeset_differencecomputes the difference between two setsset_intersectioncomputes the intersection of two setsset_symmetric_differencecomputes the symmetric difference between two setsset_unioncomputes the union of two setssortsort a range into ascending ordersort_heapturns a heap into a sorted range of elementsstable_partitiondivide elements into two groups while preserving their relative orderstable_sortsort a range of elements while preserving order between equal elementsswapswap the values of two objectsswap_rangesswaps two ranges of elementstransformapplies a function to a range of elementsuniqueremove consecutive duplicate elements in a rangeunique_copycreate a copy of some range of elements that contains no consecutive duplicatesupper_boundsearches for the last possible location to insert an element into an ordered range
原创粉丝点击