函数————count

count和count_if函数是计数函数,先来看一下count函数:
count函数的功能是:统计容器中等于value元素的个数。

count(first,last,value); first是容器的首迭代器,last是容器的末迭代器,value是询问的元素。返回value出现的次数。

 

count_if :返回区间中满足指定条件的元素数目。

count_if(first,last,value,comp); first为首迭代器,last为末迭代器,value为要查询的元素,comp为比较函数。

 

posted @ 2019-07-10 11:08  Austin_anheqiao  阅读(609)  评论(0编辑  收藏  举报