标准库算法的同一描述:
beg和end是表示元素范围的迭代器,所有算法都对一个由beg和end表示的序列进行操作。
beg2是表示第二个输入序列开始位置的迭代器。如果没有end2,则假定beg2表示的序列与beg和end表示的序列一样大。beg和beg2类型不必匹配。
dest表示目标序列的迭代器。
unaryPred和binaryPred是一元和二元谓词。分别表示接受一个和两个参数,都是来自输入序列的元素。
comp是二元谓词。
unaryOp和binaryOp是可调用对象,分别使用来自输入序列的一个和两个实参来调用。
//简单查找
find(beg,end,val)
find_if(beg,end,unaryPred)
find_if_not(beg,end,unaryPred)
count(beg,end,val)
count_if(beg,end,unaryPred)
//查找重复值
adjacent_find(beg,end)
adjacent_find(beg,end,binaryPred)
search_n(beg,end,count,val)
search_n(beg,end,count,val,binaryPred)
//查找子序列
search(beg1,end1,beg2,end2)
search(beg1,end1,beg2,end2,binaryPred)
find_first_of(beg1,end1,beg2,end2)
find_first_of(beg1,end1,beg2,end2,binaryPred)
find_end(beg1,end1,beg2,end2)
find_end(beg1,end1,beg2,end2,binaryPred)
for_each(beg,end,unaryOp)
mismatch(beg1,end1,beg2)
mismatch(beg1,end1,beg2,binaryPred)
equal(beg1,end1,beg2)
equal(beg1,end1,beg2,binaryPred)
lower_bound(beg,end,val)
lower_bound(beg,end,val,comp)
upper_bound(beg,end,val)
upper_bound(beg,end,val,comp)
equal_range(beg,end,val)
equal_range(beg,end,val,comp)
binary_search(beg,end,val)
binary_search(beg,end,val,comp)
fill(beg,end,val)
fill_n(dest,cnt,val)
generate(beg,end,Gen)
generate_n(dest,cnt,Gen)
copy(beg,end,dest)
copy_if(beg,end,dest,unaryPred)
copy_n(beg,n,dest)
move(beg,end,dest)
transform(beg,end,dest,unaryOp)
transform(beg,end,beg2,dest,binaryOp)
replace_copy(beg,end,dest,old_val,new_val)
replace_copy_if(beg,end,dest,unaryPred,new_val)
merge(beg1,end1,beg2,end2,dest)
merge(beg1,end1,beg2,end2,dest,comp)
iter_swap(iter1,iter2)
swap_ranges(beg1,end1,beg2)
replace(beg,end,old_val,new_val)
replace_if(beg,end,unaryPred,new_val)
copy_backward(beg,end,dest)
move_backward(beg,end,dest)
inplace_merge(beg,mid,end)
inplace_merge(beg,mid,end,comp)
//划分
is_partition(beg,end,unaryPred)
partition_copy(beg,end,dest1,dest2,unaryPred)
partition_point(beg,end,unaryPred)
stable_partition(beg,end,unaryPred)
partition(beg,end,unaryPred)
//排序
sort(beg,end)
stable_sort(beg,end)
sort(beg,end,comp)
stable_sort(beg,end,comp)
is_sorted(beg,end)
is_sorted(beg,end,comp)
is_sorted_until(beg,end)
is_sorted_until(beg,end,comp)
partial_sort(beg,mid,end)
partial_sort(beg,mid,end,comp)
partial_sort_copy(beg,end,destBeg,destEnd)
partial_sort_copy(beg,end,destBeg,destEnd,comp)
nth_element(beg,nth,end)
nth_element(beg,nth,end,comp)
remove,unique,reverse,rotate,random_shuffle
remove(beg,end,val)
remove_if(beg,end,unaryPred)
remove_copy(beg,end,dest,val)
remove_copy_if(beg,end,dest,unaryPred)
unique(beg,end)
unique(beg,end,binaryPred)
unique_copy(beg,end,dest)
unique_copy(beg,end,dest,binaryPred)
rotate(beg,mid,end)
rotate_copy(beg,mid,end,dest)
reverse(beg,end)
reverse_copy(beg,end)
random_shuffle(beg,end)
random_shuffle(beg,end,rand)
shuffle(beg,end,Uniform_rand)
is_permutation(beg1,end1,beg2)
is_permutation(beg1,end1,beg2,binaryPred)
next_permutation(beg,end)
next_permutation(beg,end,comp)
prev_permutation(beg,end)
prev_permutation(beg,end,comp)
includes(beg,end,beg2,end2)
includes(beg,end,beg2,end2,comp)
set_union(beg,end,beg2,end2,dest)
set_union(beg,end,beg2,end2,dest,comp)
set_intersection(beg,end,beg2,end2,dest)
set_intersection(beg,end,beg2,end2,dest,comp)
set_difference(beg,end,beg2,end2,dest)
set_difference(beg,end,beg2,end2,dest,copm)
set_symmetric_difference(beg,end,beg2,end2,dest)
set_symmetric_difference(beg,end,beg2,end2,dest,comp)
min(val1,val2)
min(val1,val2,comp)
min(init_list)
min(init_list,comp)
//min可以替换成max
minmax(val1,val2)
minmax(val1,val2,comp)
minmax(init_list)
minmax(init_list,comp)
min_element(beg,end)
min_element(beg,end,comp)
minmax_element(beg,end)
minmax_element(beg,end,comp)
//求和
accumulate(beg,end,init)
accumulate(beg,end,int,binaryOp)
//内积
inner_product(beg1,end1,beg2,init)
inner_product(beg1,end1,beg2,init,binOp1,binOp2)
partial_sum(beg,end,dest)
partial_sum(beg,end,dest,binaryOp)
adjacent_different(beg,end,dest)
adjacent_different(beg,end,dest,binaryOp)
iota(beg,end,val)