您的位置:首页 > 其它

常用STL函数用法

2014-02-06 17:10 176 查看
C++标准库总结

algorithm常用函数:("#"有该函数的实现)

非修改性序列操作 :

for_each遍历

find和find_if

count和count_if

mismatch

equal

search和search_n

is_permutation 是否是同一个排列,判断两个集合是否含有相同的元素#

修改性的序列操作 :

copy,copy_n,copy_if

transform

replace,replace_if,replace_copy,replace_copy_if

fill,fill_n

generate,generate_n

remove,remove_if

unique 去除相邻重复元素

reverse(t1.begin(),t1.end());//反转

rotate(t1.begin(),t1.begin()+4,t1.end());//循环移动

shuffle,random_shuffle 随机移动元素

划分:

partition#

is_partitioned#

sort#

二叉树:

lower_bound与upper_bound#

归并(已排序集合):

merge#

set_union,set_intersection,set_difference合集、交集、差集#

堆:

make_heap,push_heap,pop_heap,sort_heap(以最大的K个数为例)

其他:

next_permutation#

正在整理中......
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: