正文

非质变STL算法2008-12-03 19:03:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/rickone/39750.html

分享到:

for_each(first, last, pred)
返回pred,对所有i在[first, last)中,执行pred(*i)

find(first, last, value)
返回第一个i在[first, last)中,*i == value

find_if(first, last, pred)
返回第一个i在[first, last)中,pred(*i) is true

adjacent_find(first, last)
返回第一个i, *i == *(i + 1)
adjacent_find(first, last, pred)
返回第一个i, pred(*i, *(i + 1)) is true

find_first_of(first1, last1, first2, last2)
返回第一个i在[first1, last1)中,且*i == *any[first2, last2)
find_first_of(first1, last1, first2, last2, pred)
返回第一个i在[first1, last1)中,且pred(*i, *any[first2, last2)) is true

count(first, last, value)
返回i的个数,*i == value
count(first, last, value, n)
返回void, n = count(first, last, value)

count_if(first, last, pred)
返回i的个数,pred(*i) is true
count_if(first, last, pred, n)
返回void, n = count_if(first, last, pred)

mismatch(first1, last1, first2)
返回第1个pair(i = first1 + n, j = first2 + n),*i != *j
mismatch(first1, last1, first2, pred)
返回第1个pair(i = first1 + n, j = first2 + n),pred(*i, *j) is false

equal(first1, last1, first2)
返回true当且仅当2序列完全相同,否则false
equal(first1, last1, first2, pred)
同上,相同函数由pred(*i, *j)比较是否相等

search(first1, last1, first2, last2)
返回第一个i在[first1, last1)中,equal(i, i + (last2 - first2), first2) is true
search(first1, last1, first2, last2, pred)
返回第一个i在[first1, last1)中,equal(i, i + (last2 - first2), first2, pred) is true

search_n(first, last, n, value)
返回第一个i在[first, last)中,且[i, i + n)全为value
search_n(first, last, n, value, pred)
返回第一个i在[first, last)中,且j在[i, i + n)中,pred(*j, value) is true

find_end(first1, last1, first2, last2)
返回最后一个i在[first1, last1)中,equal(i, i + (last2 - first2), first2) is true
find_end(first1, last1, first2, last2, pred)
返回最后一个i在[first1, last1)中,equal(i, i + (last2 - first2), first2, pred) is true

阅读(4749) | 评论(1)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册