标准模板库(SL)介绍(下).docVIP

  • 2
  • 0
  • 约2.11万字
  • 约 20页
  • 2016-10-07 发布于贵州
  • 举报
标准模板库(SL)介绍(下)

标准模板库(STL)介绍(下) 作者: winter 作者:Scott Field 。 本文以STL容器list为例,介绍了find()函数、sort()函数,search()函数,splice()函数等,由浅入深,把list的用法和相关通用函数的用法做了详细介绍。 使用STL通用算法find()在list中查找对象   我们如何在list中查找东西呢?STL的通用算法find()和find_if()可以做这些。 就象for_each(), count(), count_if() 一样,这些算法也使用iterator范围,这个范围指出一个list或任意 其他容器中的一部分来处理。通常首iterator指着开始的位置,次iterator指着停止处理的地方。 由次iterator指出的元素不被处理。 这是find()如何工作: /* || How to find things in an STL list */ #include string #include list #include algorithm int main (void) { ??? liststring Fruit; ??? liststring::iterator FruitIterator; ??? Fruit.push_back(Apple); ??? Fruit.push

文档评论(0)

1亿VIP精品文档

相关文档