/*find_end: 函数原型: template <class FdwIt1,class FdwIt2> FdwIt1 find_end(FdwIt1 first1,FdwIt1 last,FdwIt2 first2,FdwIt2 last2); template <class FdwIt1,class FdwIt2,class Pred> FdwIt1 find_end(FdwIt1 first1,FdwIt1 last,FdwIt2 first2,FdwIt2 last2, Pred pr); 功能:在由[first1,last1)标记的序列中查找“由iteratior对[first2,last2)标记 的第二个序列”的最后一次出现。例如,已知亭子符序列mississippi和第二 个序列ss,则find_end()返回一个FwdIt1指向第二个ss序列的第一个s。如果 在第一个序列中没有找到第二个序列,则返回last1.在第一个版本中,使用底 层的等于操作符。在第二个版本中,使用用户传递进来的二元操作符pr. find_first_of(): 函数原型: template <class FwdIt1,class FwdIt2,class Pred> FwdIt1 find_first_of(FwdIt1 first1,FwdIt1 last1,FwdIt2 first2,FwdIt2 last2); template <class FwdIt1,class FwdIt2> FwdIt1 find_first_of(FwdIt1 first1,FwdIt1 last1,FwdIt2 first2,FwdIt2 last2,Pred pr); 功能:由[first2,last2)标记的序列包含了一组元素的集合,find_first_of()将在由[first1,last1) 标记的序列中搜索这些元素。例如,假设我们希望在字符序列synesthesia中找到第一个元音。 为了做到这一点,我们把第二序列定义为awiou.find_first_of()返回一个FwdIt,指向元音序列 中的元素的第一个出现。本例中,指向第一个e.如果第一个序列不含有第二个序列中的任何元素, 则返回last1.在第一个版本中,使用底层元素类型的等于操作符。在第二个版本中,使用二元操作 pr. for_each(): 函数原型: template <class InputIt,class Function> Function for_each(InputIt first,InputIt last,Function func); 功能:for_each()依次对[first,last)范围内的所有元素应用函数func,func不能对元素 执行写操作(因为前两个参数都是InputIt,所以不能保证支持赋值操作).如果我们希望修 改元素,则应该使用transform()算法。func可以返回值,但是该值会被子忽略. generate(): 函数原型: template <class FwdIt,class Generator> void generate(FwdIt first,FwdIt last,Generator gen); 功能:generate()通过对gen的连续调用,来填充一个序列的[first,last)范围。gen可以是函数对 象或函数指针。 */

评论